Table
Structured data table with header, body, row, and cell slots.
Basic
| Name | Role | |
|---|---|---|
| Sarah Johnson | sarah@example.com | Admin |
| Michael Chen | michael@example.com | Developer |
| Emily Davis | emily@example.com | Designer |
Column layout
Set column widths with <colgroup> and align cells via class on each :cell. Numeric columns read better right-aligned with font-mono.
| # | Description | Qty | Amount |
|---|---|---|---|
| 1 | Annual subscription | 1 | $1,200.00 |
| 2 | Premium support | 1 | $240.00 |
| 3 | Additional seats | 5 | $450.00 |
Rich content
Cells accept any markup. Compose avatars, badges, and stacked text inside a single :cell.
| User | Department | Last login | Status |
|---|---|---|---|
|
Sarah Johnson
Product Manager
| Engineering | 2 hours ago | Active |
|
Michael Chen
Senior Developer
| Engineering | 1 day ago | Active |
|
Emily Davis
UX Designer
| Design | 3 days ago | Away |
Row actions
| Project | Owner | Updated | |
|---|---|---|---|
| Pricing redesign | Sarah Johnson | 2 hours ago |
Project actions
|
| Mobile onboarding | Michael Chen | Yesterday |
Project actions
|
| Quarterly report | Emily Davis | 3 days ago |
Project actions
|
Selectable rows
Pure CSS row state. Drop a checkbox in the first cell and apply has-checked:highlight-strong on the row to tint the selection without any LiveView wiring.
|
| Name | Role | |
|---|---|---|---|
|
| Alice Johnson | alice@example.com | Admin |
|
| Bob Smith | bob@example.com | Developer |
|
| Charlie Brown | charlie@example.com | Manager |
|
| Diana Lee | diana@example.com | Designer |
Clickable rows
Bind phx-click on table_row for whole-row interactions. Pair with cursor-pointer and a hover tint so the affordance is obvious.
| Lead | Stage | Contact |
|---|---|---|
| Alice Smith | New | alice.smith@example.com |
| Bob Johnson | In Progress | bob.johnson@example.com |
| Carol Williams | Completed | carol.williams@example.com |
| David Brown | Urgent | david.brown@example.com |
Compact layout
Tighten py-* on cells and drop the type scale to pack more rows on screen.
| Name | Role | Status | |
|---|---|---|---|
| Emma Davis | emma@example.com | Designer | Active |
| Ryan Miller | ryan@example.com | Developer | Busy |
| Sofia Garcia | sofia@example.com | Manager | Away |
| James Wilson | james@example.com | Developer | Active |
Summary row
Use colspan on a :cell to merge columns. Combine with a font-semibold row class for totals.
| Item | Qty | Unit | Total |
|---|---|---|---|
|
Annual subscription
Pro tier
| 1 | $1,200.00 | $1,200.00 |
|
Premium support
12 months
| 1 | $240.00 | $240.00 |
|
Additional seats
5 × $90
| 5 | $90.00 | $450.00 |
| Total due | $1,890.00 | ||
Empty state
The component does not render an empty state automatically. Span a single full-width row so the table keeps its frame even with no data.
| Name | Role | Status | |
|---|---|---|---|
No users yetInvite teammates to start collaborating. |
|||
Loading skeleton
Render placeholder rows while data loads. Sized blocks with animate-pulse avoid layout shift when real rows arrive.
| Name | Role | Status | |
|---|---|---|---|
|
| |||
|
| |||
|
| |||
|
| |||
|
|
Sortable columns
Forward phx-click through the :col slot and drive the chevron icon from a server assign so the indicator stays in sync with the actual ordering.
|
Name
|
Email
|
Role
|
|---|---|---|
| Alice Johnson | alice@example.com | Admin |
| Bob Smith | bob@example.com | Developer |
| Charlie Brown | charlie@example.com | Manager |
| Diana Lee | diana@example.com | Designer |
Inventory dashboard
A composition that combines colgroup widths, sortable headers, row selection, status badges, and a per-row action.
Products
6 items in stock
|
| SKU | Status | ||||
|---|---|---|---|---|---|---|
|
| ELC-001 | Wireless Mouse | Electronics | In Stock | 150 | |
|
| ELC-014 | Mechanical Keyboard | Electronics | Low Stock | 15 | |
|
| ACC-072 | USB-C Hub | Accessories | In Stock | 75 | |
|
| ELC-027 | 27" Monitor | Electronics | On Order | 0 | |
|
| ACC-038 | Laptop Stand | Accessories | Out of Stock | 0 | |
|
| FRN-101 | Ergonomic Chair | Furniture | In Stock | 45 |