mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-20 20:33:02 +00:00
docs(data-table): add "Expandable (zebra styles)" example
This commit is contained in:
parent
6587691f58
commit
ea91f44eda
2 changed files with 69 additions and 0 deletions
|
@ -1139,6 +1139,10 @@ Use `nonExpandableRowIds` to specify the ids for rows that should not be expanda
|
||||||
|
|
||||||
<FileSource src="/framed/DataTable/DataTableNonExpandableRows" />
|
<FileSource src="/framed/DataTable/DataTableNonExpandableRows" />
|
||||||
|
|
||||||
|
### Expandable (zebra styles)
|
||||||
|
|
||||||
|
<FileSource src="/framed/DataTable/DataTableExpandableZebra" />
|
||||||
|
|
||||||
### Expandable (compact size)
|
### Expandable (compact size)
|
||||||
|
|
||||||
<DataTable size="compact" expandable
|
<DataTable size="compact" expandable
|
||||||
|
|
|
@ -0,0 +1,65 @@
|
||||||
|
<script>
|
||||||
|
import { DataTable } from "carbon-components-svelte";
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<DataTable
|
||||||
|
zebra
|
||||||
|
expandable
|
||||||
|
nonExpandableRowIds="{['a', 'd']}"
|
||||||
|
headers="{[
|
||||||
|
{ key: 'name', value: 'Name' },
|
||||||
|
{ key: 'protocol', value: 'Protocol' },
|
||||||
|
{ key: 'port', value: 'Port' },
|
||||||
|
{ key: 'rule', value: 'Rule' },
|
||||||
|
]}"
|
||||||
|
rows="{[
|
||||||
|
{
|
||||||
|
id: 'a',
|
||||||
|
name: 'Load Balancer 3',
|
||||||
|
protocol: 'HTTP',
|
||||||
|
port: 3000,
|
||||||
|
rule: 'Round robin',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'b',
|
||||||
|
name: 'Load Balancer 1',
|
||||||
|
protocol: 'HTTP',
|
||||||
|
port: 443,
|
||||||
|
rule: 'Round robin',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'c',
|
||||||
|
name: 'Load Balancer 2',
|
||||||
|
protocol: 'HTTP',
|
||||||
|
port: 80,
|
||||||
|
rule: 'DNS delegation',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'd',
|
||||||
|
name: 'Load Balancer 6',
|
||||||
|
protocol: 'HTTP',
|
||||||
|
port: 3000,
|
||||||
|
rule: 'Round robin',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'e',
|
||||||
|
name: 'Load Balancer 4',
|
||||||
|
protocol: 'HTTP',
|
||||||
|
port: 443,
|
||||||
|
rule: 'Round robin',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'f',
|
||||||
|
name: 'Load Balancer 5',
|
||||||
|
protocol: 'HTTP',
|
||||||
|
port: 80,
|
||||||
|
rule: 'DNS delegation',
|
||||||
|
},
|
||||||
|
]}"
|
||||||
|
>
|
||||||
|
<svelte:fragment slot="expanded-row" let:row>
|
||||||
|
<pre>
|
||||||
|
{JSON.stringify(row, null, 2)}
|
||||||
|
</pre>
|
||||||
|
</svelte:fragment>
|
||||||
|
</DataTable>
|
Loading…
Add table
Add a link
Reference in a new issue