mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-20 12:23:02 +00:00
docs(toggle): add "Slottable labels" example
This commit is contained in:
parent
67043ddf90
commit
456f38721e
1 changed files with 9 additions and 0 deletions
|
@ -27,6 +27,15 @@ components: ["Toggle", "ToggleSkeleton"]
|
||||||
|
|
||||||
<Toggle labelText="Push notifications" labelA="No" labelB="Yes" />
|
<Toggle labelText="Push notifications" labelA="No" labelB="Yes" />
|
||||||
|
|
||||||
|
### Slottable labels
|
||||||
|
|
||||||
|
An alternative to the "labelA" and "labelB" props is to use the corresponding named slots.
|
||||||
|
|
||||||
|
<Toggle labelText="Push notifications">
|
||||||
|
<span slot="labelA" style="color: red">No</span>
|
||||||
|
<span slot="labelB" style="color: green">Yes</span>
|
||||||
|
</Toggle>
|
||||||
|
|
||||||
### Disabled
|
### Disabled
|
||||||
|
|
||||||
<Toggle labelText="Push notifications" disabled />
|
<Toggle labelText="Push notifications" disabled />
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue