Skip to main content

Basic

A real <table> with a <caption> that names it (the caption prop, or the caption slot for markup; leave the caption out when a heading outside the table already names it), <thead>, <tbody> and scope on every header: scope="col" on the column headers and scope="row" on the first cell of each row, so a screen reader announces Alex Morgan, Department: Engineering. The cells can hold other components: an avatar with a name and an email in the row header, a badge for the status (it has text, so colour is not the only signal) and icon buttons for the actions. Each icon button has an aria-label that names the row (Edit Alex Morgan); the actions are buttons, not a dropdown, because a menu opened inside a scrolling wrapper would be clipped. Every table sits in a wrapper with overflow-x-auto, so on a narrow screen it scrolls sideways instead of breaking the page, and the wrapper is a focusable region with a name so keyboard users can scroll it. The colours are the default dominant ones: header -200, row dividers -200. Give a table a minimum width (for example min-w-2xl) when you do not want the columns to squash.

Users with their status and actions
User Department Status Actions
Alex Morgan
alex.morgan@example.com
Engineering Active
Sam Rivera
sam.rivera@example.com
Design Pending
Jordan Lee
jordan.lee@example.com
Support Suspended
Taylor Kim
taylor.kim@example.com
Finance Invited

Numbers and footer

Align numbers to the right with text-right and give them tabular-nums so the digits line up; align the column header the same way. A <tfoot> holds totals, and colspan on its row header spans the columns before the figure.

Invoice Customer Date Amount
INV-1042 Acme Inc. Oct 28, 2026 $1,280.00
INV-1041 Globex Corporation Oct 25, 2026 $340.50
INV-1040 Initech Oct 21, 2026 $2,150.00
INV-1039 Hooli Oct 18, 2026 $89.99
Total $3,860.49

Striped

striped alternates the row background (white and dominant-50), lighter than the header and the hover. Use it for wide tables where the eye has to follow a row.

Name Department Email Last active
Avery Chen Engineering avery.chen@example.com Today
Morgan Reyes Design morgan.reyes@example.com Yesterday
Jordan Okafor Support jordan.okafor@example.com 3 days ago
Sam Patel Finance sam.patel@example.com Last week

Hover

hover highlights the row under the pointer (dominant-100, dominant-800 in dark mode), one step lighter than the header.

Name Department Email Last active
Avery Chen Engineering avery.chen@example.com Today
Morgan Reyes Design morgan.reyes@example.com Yesterday
Jordan Okafor Support jordan.okafor@example.com 3 days ago
Sam Patel Finance sam.patel@example.com Last week

Striped and hover

striped and hover together: the hover colour wins over the stripe on every row.

Name Department Email Last active
Avery Chen Engineering avery.chen@example.com Today
Morgan Reyes Design morgan.reyes@example.com Yesterday
Jordan Okafor Support jordan.okafor@example.com 3 days ago
Sam Patel Finance sam.patel@example.com Last week

Variants

variant (primary, success, info, warning, danger; dominant by default) colours the header, the stripes, and the hover.

primary

Name Department Email Last active
Avery Chen Engineering avery.chen@example.com Today
Morgan Reyes Design morgan.reyes@example.com Yesterday
Jordan Okafor Support jordan.okafor@example.com 3 days ago
Sam Patel Finance sam.patel@example.com Last week
Members 4

success

Name Department Email Last active
Avery Chen Engineering avery.chen@example.com Today
Morgan Reyes Design morgan.reyes@example.com Yesterday
Jordan Okafor Support jordan.okafor@example.com 3 days ago
Sam Patel Finance sam.patel@example.com Last week

info

Name Department Email Last active
Avery Chen Engineering avery.chen@example.com Today
Morgan Reyes Design morgan.reyes@example.com Yesterday
Jordan Okafor Support jordan.okafor@example.com 3 days ago
Sam Patel Finance sam.patel@example.com Last week

warning

Name Department Email Last active
Avery Chen Engineering avery.chen@example.com Today
Morgan Reyes Design morgan.reyes@example.com Yesterday
Jordan Okafor Support jordan.okafor@example.com 3 days ago
Sam Patel Finance sam.patel@example.com Last week

danger

Name Department Email Last active
Avery Chen Engineering avery.chen@example.com Today
Morgan Reyes Design morgan.reyes@example.com Yesterday
Jordan Okafor Support jordan.okafor@example.com 3 days ago
Sam Patel Finance sam.patel@example.com Last week

Appearance

How the header is painted, separate from the variant: tinted (the default) or appearance="outline" on the header, which leaves it on the surface with a heavier line below.

subtle

Name Department Email Last active
Avery Chen Engineering avery.chen@example.com Today
Morgan Reyes Design morgan.reyes@example.com Yesterday
Jordan Okafor Support jordan.okafor@example.com 3 days ago
Sam Patel Finance sam.patel@example.com Last week

outline

Name Department Email Last active
Avery Chen Engineering avery.chen@example.com Today
Morgan Reyes Design morgan.reyes@example.com Yesterday
Jordan Okafor Support jordan.okafor@example.com 3 days ago
Sam Patel Finance sam.patel@example.com Last week

Table in card

When the table is the content of a card, let it fill the card edge to edge: the card has overflow-hidden and no padding, the title and the footer carry their own px-5, and the table uses the plain header so the header does not become a second coloured block. The cells use the same px-5 as the title so the text lines up, and the scroll region sits inside the card, so the rounded corners stay clean. The region has no border of its own here (the card already has one).

Team members

4 people in this workspace

Name Department Email Last active
Avery Chen Engineering avery.chen@example.com Today
Morgan Reyes Design morgan.reyes@example.com Yesterday
Jordan Okafor Support jordan.okafor@example.com 3 days ago
Sam Patel Finance sam.patel@example.com Last week
Showing 4 of 4

Bordered

bordered adds the lines between the columns; every table already has a frame and lines between the rows.

Name Department Email Last active
Avery Chen Engineering avery.chen@example.com Today
Morgan Reyes Design morgan.reyes@example.com Yesterday
Jordan Okafor Support jordan.okafor@example.com 3 days ago
Sam Patel Finance sam.patel@example.com Last week

Density

density changes the vertical padding of the cells: compact, standard (the default), and comfortable. Keep the touch target of any button inside a row at 24 px or more.

Compact (density="compact")

Name Department Email Last active
Avery Chen Engineering avery.chen@example.com Today
Morgan Reyes Design morgan.reyes@example.com Yesterday
Jordan Okafor Support jordan.okafor@example.com 3 days ago
Sam Patel Finance sam.patel@example.com Last week

Standard (the default)

Name Department Email Last active
Avery Chen Engineering avery.chen@example.com Today
Morgan Reyes Design morgan.reyes@example.com Yesterday
Jordan Okafor Support jordan.okafor@example.com 3 days ago
Sam Patel Finance sam.patel@example.com Last week

Comfortable (density="comfortable")

Name Department Email Last active
Avery Chen Engineering avery.chen@example.com Today
Morgan Reyes Design morgan.reyes@example.com Yesterday
Jordan Okafor Support jordan.okafor@example.com 3 days ago
Sam Patel Finance sam.patel@example.com Last week

Row and column themes

A row or a column takes a variant colour to mark a state, with plain classes on the native elements. An accent bar is a border-l-4 in the variant -500 on the first cell of the row. A tinted row keeps the stripes and the hover in its own colour: -50, -100 on even rows, and -200 under the pointer (dark -900/20, -900/35, -900/50). A column does the same on its cells (in-[tr:nth-child(even)]: and in-[tr:hover]:) and has -200 on its header. The colour classes are important (!), because the stripes, the hover, and the header colour of the table are set with stronger selectors. Colour is never the only signal: every row or column also says its state in text, a badge, or an icon with a label.

Accent bar, striped and hover

Invoice Customer Status Amount
INV-1042 Acme Inc. Scheduled $1,280.00
INV-1041 Globex Corporation Paid $340.50
INV-1040 Initech Sent $2,150.00
INV-1039 Hooli Pending $89.99
INV-1038 Umbrella Group Overdue $760.25
INV-1037 Acme Inc. Draft $1,280.00

Tinted rows, striped and hover

Task Status Owner Due
Draft the Q4 roadmap Planned Avery Chen Nov 12
Plan the onboarding revamp Planned Morgan Reyes Nov 14
Schedule customer interviews Planned Jordan Okafor Nov 18
Ship the billing export Done Sam Patel Oct 28
Migrate the email provider Done Riley Kim Oct 30
Publish the API docs Done Avery Chen Nov 02
Review the pricing page copy In review Morgan Reyes Nov 08
Review the accessibility audit In review Jordan Okafor Nov 09
Review the security checklist In review Sam Patel Nov 10
Renew the SSL certificates At risk Riley Kim Nov 11
Finish the data import tool At risk Avery Chen Nov 13
Hire a support lead At risk Morgan Reyes Nov 15
Fix failed payment retries Blocked Jordan Okafor Nov 06
Restore the nightly backups Blocked Sam Patel Nov 07
Resolve the login outage Blocked Riley Kim Nov 08

Variant per column, striped and hover

Team Planned Done In review At risk Blocked
Frontend 8 21 4 2 1
Backend 5 34 6 3 2
Design 3 12 2 1 0

Sticky header and columns

sticky-header keeps the header in view while the table scrolls down; the wrapper is limited to max-h-96. .table-sticky-left and .table-sticky-right on every cell of a column keep that column in view while the table scrolls sideways; a script sets their offsets, so several columns can stick on one side without a fixed width.

Sticky header and footer

sticky-header keeps the header in view while the rows scroll, and sticky-footer keeps the total at the bottom; the wrapper is limited to max-h-96.

Invoice Customer Date Amount
INV-1042 Acme Inc. Oct 28, 2026 $1,280.00
INV-1041 Globex Corporation Oct 25, 2026 $340.50
INV-1040 Initech Oct 21, 2026 $2,150.00
INV-1039 Hooli Oct 18, 2026 $89.99
INV-1038 Umbrella Group Oct 12, 2026 $760.25
INV-1037 Acme Inc. Oct 09, 2026 $1,280.00
INV-1036 Initech Oct 03, 2026 $415.00
INV-1035 Globex Corporation Sep 29, 2026 $99.00
INV-1034 Hooli Sep 24, 2026 $1,820.40
INV-1033 Umbrella Group Sep 20, 2026 $530.00
INV-1032 Acme Inc. Sep 14, 2026 $1,280.00
INV-1031 Initech Sep 08, 2026 $275.75
Total $9,862.24

Sticky first column

Scroll sideways and the first column stays in place: .table-sticky-left on every cell of that column, with an opaque background.

Name Email Department Role Location Last active Status Actions
Avery Chen avery.chen@example.com Engineering Developer Berlin Today Active
Morgan Reyes morgan.reyes@example.com Design Designer Lisbon Yesterday Pending
Jordan Okafor jordan.okafor@example.com Support Agent Lagos 3 days ago Suspended
Sam Patel sam.patel@example.com Finance Analyst Mumbai Last week Invited
Riley Kim riley.kim@example.com Engineering Lead Seoul Today Active

Sticky actions column

The same on the right: .table-sticky-right keeps the row actions in reach however far the table is scrolled.

Name Email Department Role Location Last active Status Actions
Avery Chen avery.chen@example.com Engineering Developer Berlin Today Active
Morgan Reyes morgan.reyes@example.com Design Designer Lisbon Yesterday Pending
Jordan Okafor jordan.okafor@example.com Support Agent Lagos 3 days ago Suspended
Sam Patel sam.patel@example.com Finance Analyst Mumbai Last week Invited
Riley Kim riley.kim@example.com Engineering Lead Seoul Today Active

Sticky column in the middle

Any column can stick, not only the first and the last: .table-sticky-left on the Role column pins it to the left edge once the table has scrolled past it.

Name Email Department Role Location Last active Status Actions
Avery Chen avery.chen@example.com Engineering Developer Berlin Today Active
Morgan Reyes morgan.reyes@example.com Design Designer Lisbon Yesterday Pending
Jordan Okafor jordan.okafor@example.com Support Agent Lagos 3 days ago Suspended
Sam Patel sam.patel@example.com Finance Analyst Mumbai Last week Invited
Riley Kim riley.kim@example.com Engineering Lead Seoul Today Active

Several sticky columns

Two sticky columns on the same side line up: the script sets the offset of the second from the width of the first, so no fixed width is needed. The actions column sticks to the right at the same time.

Name Email Department Role Location Last active Status Actions
Avery Chen avery.chen@example.com Engineering Developer Berlin Today Active
Morgan Reyes morgan.reyes@example.com Design Designer Lisbon Yesterday Pending
Jordan Okafor jordan.okafor@example.com Support Agent Lagos 3 days ago Suspended
Sam Patel sam.patel@example.com Finance Analyst Mumbai Last week Invited
Riley Kim riley.kim@example.com Engineering Lead Seoul Today Active

Sticky header and columns

Combine them: sticky-header with sticky columns. The corner cells are above both the header cells and the column cells.

Name Email Department Role Location Last active Status Actions
Avery Chen avery.chen@example.com Engineering Developer Berlin Today Active
Morgan Reyes morgan.reyes@example.com Design Designer Lisbon Yesterday Pending
Jordan Okafor jordan.okafor@example.com Support Agent Lagos 3 days ago Suspended
Sam Patel sam.patel@example.com Finance Analyst Mumbai Last week Invited
Riley Kim riley.kim@example.com Engineering Lead Seoul Today Active

Grouped header

A header of two rows. A cell that names a group spans its columns with colspan and scope="colgroup" (Q1 over Revenue and Orders); a cell that has no sub-columns spans both rows with rowspan="2" (Region, Channel). The same works in the body: rowspan on a <th scope="rowgroup"> lets one region name several rows. Keep the number of cells in every row equal to the number of columns once the spans are counted, put a border on the first cell of a group so the groups read as groups, and use border-separate border-spacing-0 if you also make the header sticky.

Region Channel Q1 Q2
Revenue Orders Revenue Orders
Americas Online $84,200 1,204 $91,750 1,311
Retail $61,480 812 $58,930 790
Europe Online $72,900 1,067 $80,115 1,152
Retail $49,310 655 $52,600 701

Empty

When there is no data keep the header and use one row whose cell spans every column (colspan) with a short message and, if it helps, the action that fixes it. Do not leave an empty body: a screen reader would announce a table with no rows.

Name Department Status

No team members yet

Invite someone and they will appear here.