mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-18 03:26:36 +00:00
29 lines
545 B
Svelte
29 lines
545 B
Svelte
<script>
|
|
import { ContentSwitcher, Switch, Button } from "carbon-components-svelte";
|
|
|
|
let selectedIndex = 1;
|
|
</script>
|
|
|
|
<style>
|
|
div {
|
|
margin-top: var(--cds-spacing-05);
|
|
}
|
|
</style>
|
|
|
|
<ContentSwitcher bind:selectedIndex>
|
|
<Switch text="Latest news" />
|
|
<Switch text="Trending" />
|
|
<Switch text="Recommended" />
|
|
</ContentSwitcher>
|
|
|
|
<div>
|
|
<Button
|
|
size="small"
|
|
disabled="{selectedIndex === 2}"
|
|
on:click="{() => (selectedIndex = 2)}"
|
|
>
|
|
Set selected to 2
|
|
</Button>
|
|
</div>
|
|
|
|
<div>Selected index: {selectedIndex}</div>
|