mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-20 12:23:02 +00:00
docs(data-table): add "Sticky header" example
This commit is contained in:
parent
4c0d6ea5a2
commit
733498621f
1 changed files with 23 additions and 0 deletions
|
@ -328,6 +328,29 @@ title="Load balancers" description="Your organization's active load balancers."
|
||||||
]}"
|
]}"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
### Sticky header
|
||||||
|
|
||||||
|
Set `stickyHeader` to `true` for the header to be fixed in place.
|
||||||
|
|
||||||
|
A maximum height will applied to the datatable to force a scrollbar.
|
||||||
|
|
||||||
|
<DataTable
|
||||||
|
stickyHeader
|
||||||
|
headers={[
|
||||||
|
{ key: "name", value: "Name" },
|
||||||
|
{ key: "protocol", value: "Protocol" },
|
||||||
|
{ key: "port", value: "Port" },
|
||||||
|
{ key: "rule", value: "Rule" },
|
||||||
|
]}
|
||||||
|
rows={Array.from({ length: 20 }).map((_, i) => ({
|
||||||
|
id: i,
|
||||||
|
name: "Load Balancer " + (i + 1),
|
||||||
|
protocol: "HTTP",
|
||||||
|
port: i % 3 ? (i % 2 ? 3000 : 80) : 443,
|
||||||
|
rule: i % 3 ? "Round robin" : "DNS delegation",
|
||||||
|
}))}
|
||||||
|
/>
|
||||||
|
|
||||||
### With toolbar
|
### With toolbar
|
||||||
|
|
||||||
<DataTable title="Load balancers" description="Your organization's active load balancers."
|
<DataTable title="Load balancers" description="Your organization's active load balancers."
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue