Table
Data table with header, body, footer sections
Start Here
Start from the smallest working snippet, then move to interactive examples and the full API contract below.
Styled quick start
Copy this entrypoint first. It includes the imports required to get the component on screen.
<script lang="ts">
import '@dryui/ui/themes/default.css';
import '@dryui/ui/themes/dark.css';
import { Table } from '@dryui/ui';
</script>
<Table.Root>
<Table.Header>
<Table.Row>
<Table.Head>Name</Table.Head>
<Table.Head>Status</Table.Head>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>Alice</Table.Cell>
<Table.Cell><Badge variant="soft">Active</Badge></Table.Cell>
</Table.Row>
</Table.Body>
</Table.Root>Import options
Root package
import { Table } from '@dryui/ui'Per-component subpath
import { Table } from '@dryui/ui/table'Customize
Use the interactive examples to see common variants, states, and composition patterns before building your own.
Team Members Table
| Member | Role | Status | |
|---|---|---|---|
Olivia Martin | olivia@acme.co | Owner | Active |
James Chen | james@acme.co | Admin | Active |
Sofia Rodriguez | sofia@acme.co | Editor | Active |
Liam Patel | liam@acme.co | Viewer | Invited |
Emma Wilson | emma@acme.co | Editor | Inactive |
<Table.Root>
<Table.Caption>Team Members</Table.Caption>
<Table.Header>
<Table.Row>
<Table.Head scope="col">Member</Table.Head>
<Table.Head scope="col">Email</Table.Head>
<Table.Head scope="col">Role</Table.Head>
<Table.Head scope="col">Status</Table.Head>
</Table.Row>
</Table.Header>
<Table.Body>
{#each users as user (user.id)}
<Table.Row>
<Table.Cell>
<div class="member-cell">
<Avatar fallback={user.initials} size="sm" />
<span class="member-name">{user.name}</span>
</div>
</Table.Cell>
<Table.Cell>{user.email}</Table.Cell>
<Table.Cell>{user.role}</Table.Cell>
<Table.Cell>
<Badge variant="soft" color={statusColor(user.status)} size="sm">
{user.status}
</Badge>
</Table.Cell>
</Table.Row>
{/each}
</Table.Body>
</Table.Root>Structure
Compound components always start with Table.Root. Use this structure block to understand required wrappers before you wire state or styling.
Table.Root
Table.Header
Table.Row
Table.Head
Table.Body
Table.Row
Table.Cell Compose
The full API contract lives here: props, CSS variables, and the public data attributes you can target when styling.
Compound component. Start with Table.Root, then add only the parts you need.
Table.Root
| Prop | Type | Default | Required | Bindable |
|---|---|---|---|---|
children | Snippet | — | ✓ | — |
Forwards <table> attributes via rest props. Common examples: id, style, aria-describedby.
Table.Header
| Prop | Type | Default | Required | Bindable |
|---|---|---|---|---|
children | Snippet | — | ✓ | — |
Forwards <tbody> attributes via rest props. Common examples: id, style, aria-describedby.
Table.Body
| Prop | Type | Default | Required | Bindable |
|---|---|---|---|---|
children | Snippet | — | ✓ | — |
Forwards <tbody> attributes via rest props. Common examples: id, style, aria-describedby.
Table.Footer
| Prop | Type | Default | Required | Bindable |
|---|---|---|---|---|
children | Snippet | — | ✓ | — |
Forwards <tbody> attributes via rest props. Common examples: id, style, aria-describedby.
Table.Row
| Prop | Type | Default | Required | Bindable |
|---|---|---|---|---|
children | Snippet | — | ✓ | — |
Forwards <tr> attributes via rest props. Common examples: id, aria-selected, role.
Table.Head
| Prop | Type | Default | Required | Bindable |
|---|---|---|---|---|
scope | colrow | — | — | — |
children | Snippet | — | ✓ | — |
Forwards <td> attributes via rest props. Common examples: colspan, rowspan, headers.
Table.Cell
| Prop | Type | Default | Required | Bindable |
|---|---|---|---|---|
children | Snippet | — | ✓ | — |
Forwards <td> attributes via rest props. Common examples: colspan, rowspan, headers.
Table.Caption
| Prop | Type | Default | Required | Bindable |
|---|---|---|---|---|
children | Snippet | — | ✓ | — |
Forwards native HTML attributes via rest props.