DataTable
Theme-aware, responsive data table component.
Usage
Components are auto-discovered. Use the component directly in any .wrn view:
<DataTable
size="default"
color="primary"
caption="Data Table"
columns="[]"
rows="[]"
/>Legacy mount name: data-component="DataTable".
Props and attributes
| Prop | Type | Requirement | Default |
|---|---|---|---|
size | string | Optional | "default" |
color | string | Optional | "primary" |
caption | string | Optional | "Data Table" |
columns | string | Optional | [] |
rows | string | Optional | [] |
striped | boolean | Optional | true |
class | string | Optional | "" |
Slots
default
Events
This component does not declare a custom event.
Source contract
Installed source: components/DataTable.wrn
component DataTable {
props {
size = "default"
color = "primary"
caption = "Data Table"
columns = []
rows = []
striped = true
class = ""
}
view {
<div class="wire-next wire-next--color-{color} wire-next--size-{size} wire-next--table {class}">
<table>
<caption>{caption}</caption>
<thead>
<tr>{#each columns as column}<th>{column.label}</th>{/each}</tr>
</thead>
<tbody>{#each rows as row}<tr>{#each columns as column}<td>{row[column.key]}</td>{/each}</tr>{/each}</tbody>
</table>
<slot />
</div>
}
}