mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-18 19:46:36 +00:00
docs(DataTable): useStaticWidth title/description
Signed-off-by: Florian-Schoenherr <florian.schoenherr99@gmail.com>
This commit is contained in:
parent
80202bfe66
commit
cec2f032d6
2 changed files with 64 additions and 63 deletions
|
@ -73,63 +73,6 @@ components: ["DataTable", "Toolbar", "ToolbarContent", "ToolbarSearch", "Toolbar
|
||||||
]}"
|
]}"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
### Static width
|
|
||||||
|
|
||||||
Set `useStaticWidth` to `true` to render the table with a width of "auto" instead of "100%".
|
|
||||||
|
|
||||||
<DataTable useStaticWidth
|
|
||||||
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"
|
|
||||||
},
|
|
||||||
]}"
|
|
||||||
/>
|
|
||||||
|
|
||||||
### Slotted cells
|
### Slotted cells
|
||||||
|
|
||||||
Use the `"cell"` slot to control the display value per table cell. Individual row and cell data are provided through the `let:row` and `let:cell` directives.
|
Use the `"cell"` slot to control the display value per table cell. Individual row and cell data are provided through the `let:row` and `let:cell` directives.
|
||||||
|
@ -321,6 +264,64 @@ The `title` and `description` props are slottable.
|
||||||
</span>
|
</span>
|
||||||
</DataTable>
|
</DataTable>
|
||||||
|
|
||||||
|
### Static width
|
||||||
|
|
||||||
|
Set `useStaticWidth` to `true` to render the table with a width of "auto" instead of "100%".
|
||||||
|
|
||||||
|
<DataTable useStaticWidth
|
||||||
|
title="Load balancers" description="Your organization's active load balancers."
|
||||||
|
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"
|
||||||
|
},
|
||||||
|
]}"
|
||||||
|
/>
|
||||||
|
|
||||||
### 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."
|
||||||
|
|
|
@ -837,9 +837,9 @@ caniuse-lite@^1.0.30001173, caniuse-lite@^1.0.30001178:
|
||||||
integrity sha512-n8JVqXuZMVSPKiPiypjFtDTXc4jWIdjxull0f92WLo7e1MSi3uJ3NvveakSh/aCl1QKFAvIz3vIj0v+0K+FrXw==
|
integrity sha512-n8JVqXuZMVSPKiPiypjFtDTXc4jWIdjxull0f92WLo7e1MSi3uJ3NvveakSh/aCl1QKFAvIz3vIj0v+0K+FrXw==
|
||||||
|
|
||||||
carbon-components-svelte@../:
|
carbon-components-svelte@../:
|
||||||
version "0.41.0"
|
version "0.42.2"
|
||||||
dependencies:
|
dependencies:
|
||||||
carbon-icons-svelte "^10.27.0"
|
carbon-icons-svelte "^10.36.0"
|
||||||
flatpickr "4.6.9"
|
flatpickr "4.6.9"
|
||||||
|
|
||||||
carbon-components@10.40.0:
|
carbon-components@10.40.0:
|
||||||
|
@ -852,10 +852,10 @@ carbon-components@10.40.0:
|
||||||
lodash.debounce "^4.0.8"
|
lodash.debounce "^4.0.8"
|
||||||
warning "^3.0.0"
|
warning "^3.0.0"
|
||||||
|
|
||||||
carbon-icons-svelte@^10.27.0:
|
carbon-icons-svelte@^10.36.0:
|
||||||
version "10.28.0"
|
version "10.36.0"
|
||||||
resolved "https://registry.yarnpkg.com/carbon-icons-svelte/-/carbon-icons-svelte-10.28.0.tgz#812a6eae858d0c9e043067c714910fcfb6249cd2"
|
resolved "https://registry.yarnpkg.com/carbon-icons-svelte/-/carbon-icons-svelte-10.36.0.tgz#3f269f2c52520d14fcd42161a633afbb7c68b4bf"
|
||||||
integrity sha512-C3K+U2PRy63WHFZme1HQNju89rhVIQmUkfgBrZzcezdutkhXbSPOY+o/MI0B2mDcQ7G9gfhEpqsXET8gBTWfJQ==
|
integrity sha512-YlrHtjdRqMFiptNVpQ4M+gMvpYDoKQydBY5A82thAXIHk9JrbrVLzq6RgJugTijHT8yzMS1zXaw6YYhqL8Qzqw==
|
||||||
|
|
||||||
caseless@~0.12.0:
|
caseless@~0.12.0:
|
||||||
version "0.12.0"
|
version "0.12.0"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue