Table

Shows data in rows and columns.

ProductCategoryPrice
MonitorElectronics999
Rice cookerKitchen64.5
BookshelfFurniture135
TabletElectronics549
BackpackAccessories89.95

Usage

Code
import { Table } from '@leverui/components';
Code
<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.

ProductCategoryPrice
MonitorElectronics999
Rice cookerKitchen64.5
BookshelfFurniture135
TabletElectronics549
BackpackAccessories89.95
ProductCategoryPrice
MonitorElectronics999
Rice cookerKitchen64.5
BookshelfFurniture135
TabletElectronics549
BackpackAccessories89.95
ProductCategoryPrice
MonitorElectronics999
Rice cookerKitchen64.5
BookshelfFurniture135
TabletElectronics549
BackpackAccessories89.95

Variants

Use the variant prop to change the appearance of the table.

ProductCategoryPrice
MonitorElectronics999
Rice cookerKitchen64.5
BookshelfFurniture135
TabletElectronics549
BackpackAccessories89.95
ProductCategoryPrice
MonitorElectronics999
Rice cookerKitchen64.5
BookshelfFurniture135
TabletElectronics549
BackpackAccessories89.95

Striped

Use the striped prop to add zebra-stripes to the table.

ProductCategoryPrice
MonitorElectronics999
Rice cookerKitchen64.5
BookshelfFurniture135
TabletElectronics549
BackpackAccessories89.95

Caption

Use the Table.Caption component to add a caption to the table.

Products in stock and their prices
ProductCategoryPrice
MonitorElectronics999
Rice cookerKitchen64.5
BookshelfFurniture135
TabletElectronics549
BackpackAccessories89.95

Caption Top

Use the captionSide prop on Table.Caption to position the caption at the top of the table.

Products in stock and their prices
ProductCategoryPrice
MonitorElectronics999
Rice cookerKitchen64.5
BookshelfFurniture135
TabletElectronics549
BackpackAccessories89.95

Column Border

Use the showColumnBorder prop to add borders between columns.

ProductCategoryPrice
MonitorElectronics999
Rice cookerKitchen64.5
BookshelfFurniture135
TabletElectronics549
BackpackAccessories89.95

Overflow

Render the Table.ScrollArea component to enable horizontal scrolling.

ProductCategoryPrice
MonitorElectronics999
Rice cookerKitchen64.5
BookshelfFurniture135
TabletElectronics549
BackpackAccessories89.95

Sticky Header

Use the stickyHeader prop to make the table header sticky.

ProductCategoryPrice
MonitorElectronics999
Rice cookerKitchen64.5
BookshelfFurniture135
TabletElectronics549
BackpackAccessories89.95

Sticky Column

Here's an example what uses data-sticky attributes to make table columns sticky during horizontal scrolling.

ProductCategoryPrice
MonitorElectronics999
Rice cookerKitchen64.5
BookshelfFurniture135
TabletElectronics549
BackpackAccessories89.95

Sticky Header and Column

Combine stickyHeader with data-sticky attributes to create a table with both a sticky header and sticky columns. When using both features together, ensure the header row has a higher z-index to keep sticky column headers visible.

ProductCategoryPrice
HeadphonesElectronics834.12
Desk chairFurniture245.88
MicrowaveHome appliances379.26
BackpackAccessories112.47
FootballSports95.14
SmartphoneElectronics921.63
Wrist watchAccessories418.52
T-shirtClothing35.29
Vacuum cleanerHome appliances601.22
LampFurniture157.88
DroneElectronics836.15
PerfumeBeauty128.9
Camping tentOutdoors458.4
Cookware setHome appliances292.86
CameraElectronics792.54
SneakersClothing154.61
MonitorElectronics348.57
Gaming consoleElectronics896.01
KeyboardElectronics94.71
SofaFurniture719.33
TabletElectronics612.57
Action figureToys73.49
SmartwatchElectronics482.46
TentOutdoors623.3
Cookware setHome appliances257.38
HelmetSports88.26
Hair dryerBeauty164.79
LampFurniture122.1
Electric kettleHome appliances69.42
SneakersClothing182.13
DroneElectronics934.72
Coffee makerHome appliances148.99
BackpackAccessories81.22
MicrowaveHome appliances399.53
T-shirtClothing45.33
Vacuum cleanerHome appliances552.87

Highlight on Hover

Use the interactive prop to highlight rows on hover.

ProductCategoryPrice
MonitorElectronics999
Rice cookerKitchen64.5
BookshelfFurniture135
TabletElectronics549
BackpackAccessories89.95

Pagination

Here's an example of how to compose a table with pagination.

Products

ProductCategoryPrice
MonitorElectronics999
Rice cookerKitchen64.5
BookshelfFurniture135
TabletElectronics549
BackpackAccessories89.95

Selection

Here's an example of how to add row selection with checkboxes to your table.

ProductCategoryPrice
MonitorElectronics$999
Rice cookerKitchen$64.5
BookshelfFurniture$135
TabletElectronics$549
BackpackAccessories$89.95

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.

ProductCategoryPrice
MonitorElectronics$999
Rice cookerKitchen$64.5
BookshelfFurniture$135
TabletElectronics$549
BackpackAccessories$89.95

Column Group

Use the Table.ColumnGroup component to distribute the column widths using the html colgroup element.

Set each width with the htmlWidth prop. Browsers apply only a few CSS properties to col elements.

ProductCategoryPrice
MonitorElectronics999
Rice cookerKitchen64.5
BookshelfFurniture135
TabletElectronics549
BackpackAccessories89.95

Native Mode

Use the native prop to render table descendants using native HTML elements (<thead>, <tbody>, <tr>, <td>, <th>) instead of Lever UI's styled components.

This is a great way to improve performance for large tables by eliminating the per-part components and Solid context overhead.

ProductCategoryPrice
MonitorElectronics$999.00
Rice cookerKitchen$64.50
BookshelfFurniture$135.00
TabletElectronics$549.00
BackpackAccessories$89.95

TanStack Table

Lever UI works seamlessly with TanStack Table for advanced table features.

ProductCategoryPriceStock
MonitorElectronics$999.0050
Rice cookerKitchen$64.50120
BookshelfFurniture$135.0030
TabletElectronics$549.0075
BackpackAccessories$89.95200

See the TanStack Table documentation for its Solid adapter.

Props

Root

PropDefaultTypeDescription
colorPalettegray'gray' | 'red' | 'orange' | 'yellow' | 'green' | 'teal' | 'blue' | 'cyan' | 'purple' | 'pink'Color palette.
variantline'line' | 'outline'Table style.
sizemd'sm' | 'md' | 'lg'Table size. Responsive.
native—booleanStyle plain HTML table elements inside the root, such as tr and td.
astableNative HTML tagHTML tag to render.
asChild—Solid render functionRender your own element with the table's props.
unstyledfalsebooleanTurn off the Lever UI styles. Markup and classes stay.
interactive—booleanHighlight a row on hover.
stickyHeader—booleanKeep the header in view while the table scrolls.
striped—booleanShade every other row.
showColumnBorder—booleanAdd borders between columns.

Table renders plain HTML table elements. It adds no keyboard handling, selection state, or ARIA roles. Use what HTML tables already have, such as scope on column headers. The root and the parts pass native attributes, events, refs, class, and style to their elements.

Caption sits below the table by default (captionSide="bottom"). In native mode a plain caption element stays at the top. To move it down, use Table.Caption or your own CSS.

Use ColumnGroup and Column for column widths, Footer for totals and summaries, and ScrollArea when the table is wider than its container.

Table.RootPropsProvider sets reactive default props for the roots inside it. If the defaults depend on a signal, pass a function that returns them. A prop on a root wins.

With a headless data grid library, render the headers and rows from its Solid adapter inside Table.Root native. The TanStack example uses @tanstack/solid-table. Install that package yourself.

Customize with CSS

Classes: .leverui-table__root, __header, __body, __row, __columnHeader, __cell, __footer, __caption, __columnGroup, __column, and __scrollArea. The root also has attributes for size, variant, stripes, hover, sticky header, column borders, palette, native mode, and unstyled. Override these, or the --leverui-* tokens, in your own CSS. Add a part's class to your own HTML element to give it that part's look.

Code
<Table.Root>
  <Table.Body>
    <Table.Row>
      <td class="leverui-table__cell custom-cell">Custom cell</td>
    </Table.Row>
  </Table.Body>
</Table.Root>
Code
.custom-cell {
  text-align: end;
}

Explorer

Click a part name to highlight it in the preview.

Component Anatomy

Hover to highlight, click to select parts