| Product | Category | Price |
|---|---|---|
| Laptop | Electronics | 999.99 |
| Coffee Maker | Home Appliances | 49.99 |
| Desk Chair | Furniture | 150 |
| Smartphone | Electronics | 799.99 |
| Headphones | Accessories | 199.99 |
Usage
import { Table } from "@chakra-ui/react"<Table.Root>
<Table.Caption />
<Table.Header>
<Table.Row>
<Table.ColumnHeader />
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell />
</Table.Row>
</Table.Body>
<Table.Footer>
<Table.Row>
<Table.Cell />
</Table.Row>
</Table.Footer>
</Table.Root>Examples
Sizes
Use the size prop to change the size of the table.
| Product | Category | Price |
|---|---|---|
| Laptop | Electronics | 999.99 |
| Coffee Maker | Home Appliances | 49.99 |
| Desk Chair | Furniture | 150 |
| Smartphone | Electronics | 799.99 |
| Headphones | Accessories | 199.99 |
| Product | Category | Price |
|---|---|---|
| Laptop | Electronics | 999.99 |
| Coffee Maker | Home Appliances | 49.99 |
| Desk Chair | Furniture | 150 |
| Smartphone | Electronics | 799.99 |
| Headphones | Accessories | 199.99 |
| Product | Category | Price |
|---|---|---|
| Laptop | Electronics | 999.99 |
| Coffee Maker | Home Appliances | 49.99 |
| Desk Chair | Furniture | 150 |
| Smartphone | Electronics | 799.99 |
| Headphones | Accessories | 199.99 |
Variants
Use the variant prop to change the appearance of the table.
| Product | Category | Price |
|---|---|---|
| Laptop | Electronics | 999.99 |
| Coffee Maker | Home Appliances | 49.99 |
| Desk Chair | Furniture | 150 |
| Smartphone | Electronics | 799.99 |
| Headphones | Accessories | 199.99 |
| Product | Category | Price |
|---|---|---|
| Laptop | Electronics | 999.99 |
| Coffee Maker | Home Appliances | 49.99 |
| Desk Chair | Furniture | 150 |
| Smartphone | Electronics | 799.99 |
| Headphones | Accessories | 199.99 |
Striped
Use the striped prop to add zebra-stripes to the table.
| Product | Category | Price |
|---|---|---|
| Laptop | Electronics | 999.99 |
| Coffee Maker | Home Appliances | 49.99 |
| Desk Chair | Furniture | 150 |
| Smartphone | Electronics | 799.99 |
| Headphones | Accessories | 199.99 |
Caption
Use the Table.Caption component to add a caption to the table.
| Product | Category | Price |
|---|---|---|
| Laptop | Electronics | 999.99 |
| Coffee Maker | Home Appliances | 49.99 |
| Desk Chair | Furniture | 150 |
| Smartphone | Electronics | 799.99 |
| Headphones | Accessories | 199.99 |
Caption Top
Use the side prop on Table.Caption to position the caption at the top of the
table.
| Product | Category | Price |
|---|---|---|
| Laptop | Electronics | 999.99 |
| Coffee Maker | Home Appliances | 49.99 |
| Desk Chair | Furniture | 150 |
| Smartphone | Electronics | 799.99 |
| Headphones | Accessories | 199.99 |
Column Border
Use the showColumnBorder prop to add borders between columns.
| Product | Category | Price |
|---|---|---|
| Laptop | Electronics | 999.99 |
| Coffee Maker | Home Appliances | 49.99 |
| Desk Chair | Furniture | 150 |
| Smartphone | Electronics | 799.99 |
| Headphones | Accessories | 199.99 |
Overflow
Render the Table.ScrollArea component to enable horizontal scrolling.
| Product | Category | Price |
|---|---|---|
| Laptop | Electronics | 999.99 |
| Coffee Maker | Home Appliances | 49.99 |
| Desk Chair | Furniture | 150 |
| Smartphone | Electronics | 799.99 |
| Headphones | Accessories | 199.99 |
Sticky Header
Use the stickyHeader prop to make the table header sticky.
| Product | Category | Price |
|---|---|---|
| Laptop | Electronics | 999.99 |
| Coffee Maker | Home Appliances | 49.99 |
| Desk Chair | Furniture | 150 |
| Smartphone | Electronics | 799.99 |
| Headphones | Accessories | 199.99 |
Sticky Column
Here's an example what uses data-sticky attributes to make table columns
sticky during horizontal scrolling.
| Product | Category | Price |
|---|---|---|
| Laptop | Electronics | 999.99 |
| Coffee Maker | Home Appliances | 49.99 |
| Desk Chair | Furniture | 150 |
| Smartphone | Electronics | 799.99 |
| Headphones | Accessories | 199.99 |
Highlight on Hover
Use the interactive prop to highlight rows on hover.
| Product | Category | Price |
|---|---|---|
| Laptop | Electronics | 999.99 |
| Coffee Maker | Home Appliances | 49.99 |
| Desk Chair | Furniture | 150 |
| Smartphone | Electronics | 799.99 |
| Headphones | Accessories | 199.99 |
Pagination
Here's an example of how to compose a table with pagination.
Products
| Product | Category | Price |
|---|---|---|
| Laptop | Electronics | 999.99 |
| Coffee Maker | Home Appliances | 49.99 |
| Desk Chair | Furniture | 150 |
| Smartphone | Electronics | 799.99 |
| Headphones | Accessories | 199.99 |
Selection
Here's an example of how to add row selection with checkboxes to your table.
| Product | Category | Price | |
|---|---|---|---|
| Laptop | Electronics | $999.99 | |
| Coffee Maker | Home Appliances | $49.99 | |
| Desk Chair | Furniture | $150 | |
| Smartphone | Electronics | $799.99 | |
| Headphones | Accessories | $199.99 |
Action Bar
Here's an example of how to compose a table with an action bar and checkboxes. This is useful for showing actions for selected table rows.
| Product | Category | Price | |
|---|---|---|---|
| Laptop | Electronics | $999.99 | |
| Coffee Maker | Home Appliances | $49.99 | |
| Desk Chair | Furniture | $150 | |
| Smartphone | Electronics | $799.99 | |
| Headphones | Accessories | $199.99 |
Column Group
Use the Table.ColumnGroup component to distribute the column widths using the
html colgroup element.
htmlWidth| Product | Category | Price |
|---|---|---|
| Laptop | Electronics | 999.99 |
| Coffee Maker | Home Appliances | 49.99 |
| Desk Chair | Furniture | 150 |
| Smartphone | Electronics | 799.99 |
| Headphones | Accessories | 199.99 |
Native Mode
Use the native prop to render table descendants using native HTML elements
(<thead>, <tbody>, <tr>, <td>, <th>) instead of Chakra's styled
components.
This is a great way to improve performance for large tables by eliminating the runtime styling and React Context overhead.
| Product | Category | Price |
|---|---|---|
| Laptop | Electronics | $999.00 |
| Coffee Maker | Home Appliances | $49.99 |
| Desk Chair | Furniture | $150.00 |
| Smartphone | Electronics | $799.99 |
| Headphones | Accessories | $199.99 |
TanStack Table
Chakra UI works seamlessly with TanStack Table for advanced table features.
| Product | Category | Price | Stock |
|---|---|---|---|
| Laptop | Electronics | $999.99 | 50 |
| Coffee Maker | Home Appliances | $49.99 | 120 |
| Desk Chair | Furniture | $150.00 | 30 |
| Smartphone | Electronics | $799.99 | 75 |
| Headphones | Accessories | $199.99 | 200 |
Props
Root
| Prop | Default | Type |
|---|---|---|
colorPalette | gray | 'gray' | 'red' | 'orange' | 'yellow' | 'green' | 'teal' | 'blue' | 'cyan' | 'purple' | 'pink'The color palette of the component |
variant | line | 'line' | 'outline'The variant of the component |
size | md | 'sm' | 'md' | 'lg'The size of the component |
native | boolean | undefinedIf `true`, the table will style its descendants with nested selectors | |
as | React.ElementTypeThe underlying element to render. | |
asChild | booleanUse the provided child element as the default rendered element, combining their props and behavior. For more details, read our Composition guide. | |
unstyled | booleanWhether to remove the component's style. | |
interactive | 'true' | 'false'The interactive of the component | |
stickyHeader | 'true' | 'false'The stickyHeader of the component | |
striped | 'true' | 'false'The striped of the component | |
showColumnBorder | 'true' | 'false'The showColumnBorder of the component |
Explorer
Explore the Table component parts interactively. Click on parts in the sidebar
to highlight them in the preview.
| Product | Category | Price | Stock |
|---|---|---|---|
| Laptop | Electronics | $999.99 | 12 |
| Coffee Maker | Home Appliances | $49.99 | 35 |
| Desk Chair | Furniture | $150.00 | 8 |
| Smartphone | Electronics | $799.99 | 20 |
| Headphones | Accessories | $199.99 | 50 |
| Total | $2199.96 | 125 | |
Component Anatomy
Hover to highlight, click to select parts
root
header
body
row
columnHeader
cell
footer
caption