|
| 1 | +<script lang="ts"> |
| 2 | + import { Meta, Template, Story } from '@storybook/addon-svelte-csf'; |
| 3 | + import { Accordion } from './index'; |
| 4 | +
|
| 5 | + let value = 'typescript'; |
| 6 | +</script> |
| 7 | + |
| 8 | +<Meta title="Components/Accordion" component={Accordion} /> |
| 9 | + |
| 10 | +<Template let:args> |
| 11 | + <Accordion {...args} defaultValue="typescript"> |
| 12 | + <Accordion.Item value="typescript"> |
| 13 | + <div slot="control">Typescript Based</div> |
| 14 | + Build type safe applications. All SvelteUI packages are built with TypeScript and support it by |
| 15 | + default. All components and functions export types, are documented, and give developers autocomplete |
| 16 | + features! |
| 17 | + </Accordion.Item> |
| 18 | + <Accordion.Item value="packed"> |
| 19 | + <div slot="control">Feature packed</div> |
| 20 | + SvelteUI contains more than just components. With Actions, Transitions, and Utilities available |
| 21 | + to you, development will be fun and easy! |
| 22 | + </Accordion.Item> |
| 23 | + <Accordion.Item value="accessible"> |
| 24 | + <div slot="control">Accessible and usable</div> |
| 25 | + All components are accessible according to WAI-ARIA standards. On top of that, no annoying focus |
| 26 | + ring. It will appear only when user navigates with keyboard. |
| 27 | + </Accordion.Item> |
| 28 | + </Accordion> |
| 29 | +</Template> |
| 30 | + |
| 31 | +<Story name="Accordion" id="accordionStory" /> |
| 32 | + |
| 33 | +<Story name="Multiple Tabs Open" id="accordionMultipleStory" args={{ multiple: true }} /> |
| 34 | + |
| 35 | +<Story name="Disabled Tabs" id="accordionDisabledStory"> |
| 36 | + <Accordion defaultValue="typescript"> |
| 37 | + <Accordion.Item value="typescript"> |
| 38 | + <div slot="control">Typescript Based</div> |
| 39 | + Build type safe applications. All SvelteUI packages are built with TypeScript and support it by |
| 40 | + default. All components and functions export types, are documented, and give developers autocomplete |
| 41 | + features! |
| 42 | + </Accordion.Item> |
| 43 | + <Accordion.Item value="packed" disabled> |
| 44 | + <div slot="control">Feature packed</div> |
| 45 | + SvelteUI contains more than just components. With Actions, Transitions, and Utilities available |
| 46 | + to you, development will be fun and easy! |
| 47 | + </Accordion.Item> |
| 48 | + <Accordion.Item value="accessible"> |
| 49 | + <div slot="control">Accessible and usable</div> |
| 50 | + All components are accessible according to WAI-ARIA standards. On top of that, no annoying focus |
| 51 | + ring. It will appear only when user navigates with keyboard. |
| 52 | + </Accordion.Item> |
| 53 | + </Accordion> |
| 54 | +</Story> |
| 55 | + |
| 56 | +<Story name="Multiple Tabs Open With Default" id="accordionMultipleDefaultStory"> |
| 57 | + <Accordion multiple={true} defaultValue={['packed', 'accessible']}> |
| 58 | + <Accordion.Item value="typescript"> |
| 59 | + <div slot="control">Typescript Based</div> |
| 60 | + Build type safe applications. All SvelteUI packages are built with TypeScript and support it by |
| 61 | + default. All components and functions export types, are documented, and give developers autocomplete |
| 62 | + features! |
| 63 | + </Accordion.Item> |
| 64 | + <Accordion.Item value="packed"> |
| 65 | + <div slot="control">Feature packed</div> |
| 66 | + SvelteUI contains more than just components. With Actions, Transitions, and Utilities available |
| 67 | + to you, development will be fun and easy! |
| 68 | + </Accordion.Item> |
| 69 | + <Accordion.Item value="accessible"> |
| 70 | + <div slot="control">Accessible and usable</div> |
| 71 | + All components are accessible according to WAI-ARIA standards. On top of that, no annoying focus |
| 72 | + ring. It will appear only when user navigates with keyboard. |
| 73 | + </Accordion.Item> |
| 74 | + </Accordion> |
| 75 | +</Story> |
| 76 | + |
| 77 | +<Story name="Controlled" id="accordionControlledStory"> |
| 78 | + <Accordion {value} on:change={(e) => (value = e.detail)}> |
| 79 | + <Accordion.Item value="typescript"> |
| 80 | + <div slot="control">Typescript Based</div> |
| 81 | + Build type safe applications. All SvelteUI packages are built with TypeScript and support it by |
| 82 | + default. All components and functions export types, are documented, and give developers autocomplete |
| 83 | + features! |
| 84 | + </Accordion.Item> |
| 85 | + <Accordion.Item value="packed"> |
| 86 | + <div slot="control">Feature packed</div> |
| 87 | + SvelteUI contains more than just components. With Actions, Transitions, and Utilities available |
| 88 | + to you, development will be fun and easy! |
| 89 | + </Accordion.Item> |
| 90 | + <Accordion.Item value="accessible"> |
| 91 | + <div slot="control">Accessible and usable</div> |
| 92 | + All components are accessible according to WAI-ARIA standards. On top of that, no annoying focus |
| 93 | + ring. It will appear only when user navigates with keyboard. |
| 94 | + </Accordion.Item> |
| 95 | + </Accordion> |
| 96 | +</Story> |
0 commit comments