Table
Theme-aware, responsive table component.
Usage
Components are auto-discovered. Use the component directly in any .wrn view:
<Table
size="default"
color="primary"
caption="Table"
columns="[]"
rows="[]"
/>Legacy mount name: data-component="Table".
Props and attributes
| Prop | Type | Requirement | Default |
|---|---|---|---|
size | string | Optional | "default" |
color | string | Optional | "primary" |
caption | string | Optional | "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/Table.wrn
component Table {
props {
size = "default"
color = "primary"
caption = "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>
}
}