mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-18 11:36:36 +00:00
parent
7a70c1d608
commit
38a34c53f9
2 changed files with 40 additions and 0 deletions
|
@ -20,6 +20,10 @@ components: ["Tabs", "Tab", "TabContent", "TabsSkeleton"]
|
|||
</div>
|
||||
</Tabs>
|
||||
|
||||
### Reactive example
|
||||
|
||||
<FileSource src="/framed/Tabs/TabsReactive" />
|
||||
|
||||
### Container type
|
||||
|
||||
<Tabs type="container">
|
||||
|
|
36
docs/src/pages/framed/Tabs/TabsReactive.svelte
Normal file
36
docs/src/pages/framed/Tabs/TabsReactive.svelte
Normal file
|
@ -0,0 +1,36 @@
|
|||
<script>
|
||||
import { Tabs, Tab, TabContent, Button } from "carbon-components-svelte";
|
||||
|
||||
let selected = 0;
|
||||
</script>
|
||||
|
||||
<Tabs bind:selected>
|
||||
<Tab label="Tab label 1" />
|
||||
<Tab label="Tab label 2" />
|
||||
<Tab label="Tab label 3" />
|
||||
<div slot="content">
|
||||
<TabContent>Content 1</TabContent>
|
||||
<TabContent>Content 2</TabContent>
|
||||
<TabContent>Content 3</TabContent>
|
||||
</div>
|
||||
</Tabs>
|
||||
|
||||
<div>
|
||||
<h4>Selected index: {selected}</h4>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<Button
|
||||
size="small"
|
||||
disabled="{selected === 1}"
|
||||
on:click="{() => (selected = 1)}"
|
||||
>
|
||||
Set index to 1
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
div {
|
||||
margin-top: var(--cds-spacing-05);
|
||||
}
|
||||
</style>
|
Loading…
Add table
Add a link
Reference in a new issue