Table Component
The ds-table component provides a styled data table for displaying structured information.
Flexible Content
Section titled “Flexible Content”Table cells can contain any content - text, components, buttons, icons, or any combination. Use ds-button, ds-icon, ds-text, or any other component inside table cells.
Basic Usage
Section titled “Basic Usage”<ds-table> <ds-table-header> <ds-table-cell>Name</ds-table-cell> <ds-table-cell>Email</ds-table-cell> <ds-table-cell>Role</ds-table-cell> </ds-table-header> <ds-table-row> <ds-table-cell>John Doe</ds-table-cell> <ds-table-cell>Admin</ds-table-cell> </ds-table-row></ds-table>With Data Binding
Section titled “With Data Binding”<ds-table id="userTable"></ds-table>
<script> const table = document.getElementById('userTable'); table.data = [ ]; table.columns = ['name', 'email', 'role'];</script>Attributes
Section titled “Attributes”| Attribute | Type | Default | Description |
|---|---|---|---|
striped | boolean | false | Alternating row colors |
hoverable | boolean | false | Highlight rows on hover |
compact | boolean | false | Reduced padding |
bordered | boolean | false | Show cell borders |
Styling Variants
Section titled “Styling Variants”Striped
Section titled “Striped”<ds-table striped> <!-- rows --></ds-table>Hoverable
Section titled “Hoverable”<ds-table hoverable> <!-- rows --></ds-table>Compact
Section titled “Compact”<ds-table compact> <!-- rows --></ds-table>Examples
Section titled “Examples”User List
Section titled “User List”<ds-table striped hoverable> <ds-table-header> <ds-table-cell>User</ds-table-cell> <ds-table-cell>Status</ds-table-cell> <ds-table-cell>Actions</ds-table-cell> </ds-table-header> <ds-table-row> <ds-table-cell>John Doe</ds-table-cell> <ds-table-cell>Active</ds-table-cell> <ds-table-cell> <ds-button variant="text">Edit</ds-button> </ds-table-cell> </ds-table-row></ds-table>