Code
In context
Install · Free Web Component
One file, no dependencies. Aurora preset, every other option included. Host it yourself so your visitors never load anything from our servers.
The shadcn command adds a typed React wrapper for you. Using the file directly? Custom elements work in React as-is; for type checking add:
Pro · React + TypeScript Pro
One payment of $4.99, yours forever. Use it in unlimited personal and commercial projects; no resale.
- React component driven by
columnsandrows— cells take any React content — with TypeScript types and the full source - Sunset, Mint and Mono tints, plus custom tints from Brand Fit
- The vanilla Web Component with every tint, a demo page, README and license
Attributes & props
| Name | Type | Default | Description |
|---|---|---|---|
| <table> | child | — | A plain HTML table with a thead and a tbody. It stays a real table: without the script it is still readable. Call el.refresh() after adding rows from script. |
| <th data-sort> | 'text' | 'number' | 'none' | 'text' | How a column sorts. number reads "$1,240.00" or "12%" as a number; none leaves the header as plain text. A cell can carry data-value="…" to sort by something other than its text. |
| <th data-align> | 'start' | 'end' | end for numbers | end right-aligns the column and uses tabular numerals. |
| sort | column index | data-key | label | — | The sorted column. Changes when a header is pressed and fires sort with detail.column, detail.key and detail.dir. |
| dir | 'asc' | 'desc' | 'asc' | Sort direction. |
| selectable | 'none' | 'single' | 'multiple' | 'none' | Rows can be selected by click, Space or Enter. Fires select with detail.rows — indices in the original order. Mark a row <tr selected> to start with it selected; el.selected reads and sets the list. |
| sticky | boolean | off | The header stays in place while the body scrolls inside height. |
| height | number (px) | 320 | Max height of the scrolling area, with sticky. |
| size | number (px) | 48 | Row height; the type and the paddings scale with it. |
| width | number (px) | CSS width | 100% | Slab width. When the columns do not fit, the table scrolls sideways inside the slab. |
| theme | 'light' | 'dark' | 'light' | White porcelain or dark. |
| sound | boolean | off | A porcelain tap on sort and select. Also on for everything inside an element with data-ui-sound="on". |
| tint Pro | 'aurora' | 'sunset' | 'mint' | 'mono' | object | 'aurora' | Colours of the sort bead and the selection strand, or a custom tint. Free build ships Aurora only. |
It is a real <table>: column headers have scope="col" and aria-sort, and each sortable header is a button. With selectable the table becomes a grid: Tab reaches one row, Up / Down, Home and End move between rows, Space or Enter selects, and rows carry aria-selected. Every click on a row also fires rowclick with detail.index (links and buttons inside a cell keep working and do not select). The sort animation moves rows with transforms only, so there is no layout thrash; reduced motion sorts at once. Sorting happens in the browser — for server-side sorting, listen to sort and replace the rows. All CSS, no WebGL.
More components
- Halo Avatar
- Pearl Steps
- Pearl Skeleton
- Pearl Empty
- Tide Slide
- Pearl Code
- Ink Sphere
- Frost Card
- Holo Card
- Stream Text
- Lens Compare
- Pearl Dial
- Nova Rating
- Pearl Check
- Pearl Input
- Glass Toast
- Pearl Select
- Glass Sheet
- Pearl Accordion
- Glass Tip
- Pearl Calendar
- Glass Nav
- Pearl Tabs
- Glass Command
- Pearl Chip
- Roll Counter
- Glass Marquee
- Reveal Text
- Mesh Gradient
- Silk Waves
- Dot Field
- Plasma Orb
- Voice Wave
- Plush Buddy
- Gummy Agent
- Glass Tabbar
- Glass Menu
- Pearl Pricing
- Glass Bento
- Quote Wall
- Glass Cta
- Magnet Button
- Beam Border
- Spotlight Card
- Scratch Reveal
- Glass Sidebar
- Pearl Pagination
- Pearl Breadcrumb
- Glass Dock
- Pearl Slider
- Pearl Segmented
- Liquid Metal Button
- Mercury Orb
- Prompt Input
- Voice Orb
- Aurora Ring
- Glass Toggle
- Firefly Button
- Pearl Button
- Pearl Loader
- Alien Face
- Prism Button
- Liquid Carousel
- Orbit Carousel
- Deck Carousel