Table
Data tables with sorting and responsive features
Display tabular data with optional sorting, custom rendering, and mobile responsiveness.
Usage
| name | stars | language |
|---|---|---|
| react | 220000 | javascript |
| vue | 205000 | typescript |
| svelte | 75000 | typescript |
Sorting
Enable sorting on columns with sortable:
| language | ||
|---|---|---|
| react | 220000 | javascript |
| vue | 205000 | typescript |
| svelte | 75000 | typescript |
Custom rendering
use the render function to customize cell output:
Responsive
Hide columns on mobile with hideOnMobile:
| name | stars |
|---|---|
| react | 220000 |
| vue | 205000 |
| svelte | 75000 |
Styles
Striped
Alternating row colors:
| name | stars |
|---|---|
| react | 220000 |
| vue | 205000 |
| svelte | 75000 |
| solid | 30000 |
Compact
Reduced padding:
| name | stars |
|---|---|
| react | 220000 |
| vue | 205000 |
| svelte | 75000 |
Column width
Set fixed widths:
Props
Table
| prop | type | default | description |
|---|---|---|---|
| data | T[] | - | Array of row objects |
| columns | TableColumn[] | - | Column definitions |
| defaultSort | string | - | Initial sort column key |
| defaultDirection | "asc" | "desc" | "asc" | Initial sort direction |
| striped | boolean | false | Alternating row colors |
| hoverable | boolean | true | Row hover effect |
| compact | boolean | false | Reduced padding |
| caption | string | - | Accessible table description |
| className | string | - | Additional CSS classes |
Tablecolumn
| prop | type | default | description |
|---|---|---|---|
| key | string | - | Property name from data |
| header | string | - | Column header text |
| sortable | boolean | false | Enable sorting |
| width | string | - | Fixed column width |
| render | function | - | Custom cell renderer |
| hideOnMobile | boolean | false | Hide on small screens |