···99 I mean, I hope so? It's based on the bits-ui accordion component, so if not it's not my fault 😅
1010 </AccordionItem>
1111</Accordion>
1212-```
1313-1414-## Credits
1515-1616-This component is based on the [bits-ui accordion component](https://bits-ui.com/docs/components/accordion).
1212+```
+81
apps/docs/src/lib/docs/core/accordion/api.ts
···11+import type { APISchema } from '$lib/types/schema';
22+33+export default [
44+ {
55+ title: 'Accordion',
66+ description:
77+ 'A vertically stacked set of interactive headings that each reveal a section of content.',
88+ props: {
99+ children: {
1010+ type: 'Snippet',
1111+ description:
1212+ 'The children content to render. Should be a list of AccordionItem components.',
1313+ required: true
1414+ },
1515+ type: {
1616+ type: { type: 'enum', definition: "'single' | 'multiple'" },
1717+ description:
1818+ "If set to 'multiple', the accordion will allow multiple items to be open at the same time. If set to single, the accordion will only allow a single item to be open.",
1919+ required: true
2020+ },
2121+ value: {
2222+ type: { type: 'union', definition: 'string | string[]' },
2323+ description:
2424+ 'The value of the accordion item that is currently open. If type is set to "multiple", this will be an array of strings. If type is set to "single", this will be a string.',
2525+ bindable: true
2626+ },
2727+ onValueChange: {
2828+ type: {
2929+ type: 'function',
3030+ definition: '(value: string) => void | (value: string[]) => void'
3131+ },
3232+ description: 'A function that is called when the value of the accordion item changes.'
3333+ },
3434+ disabled: {
3535+ type: 'boolean',
3636+ description: 'Whether the accordion is disabled.',
3737+ default: 'false'
3838+ },
3939+ ref: {
4040+ type: 'HTMLDivElement',
4141+ description:
4242+ 'The underlying DOM element being rendered. You can bind to this to get a reference to the element.',
4343+ bindable: true
4444+ }
4545+ }
4646+ },
4747+ {
4848+ title: 'AccordionItem',
4949+ description: 'A single collapsible section within the accordion.',
5050+ props: {
5151+ title: {
5252+ type: 'string',
5353+ description:
5454+ 'The title of the accordion item, displayed both when the item is closed or open.',
5555+ required: true
5656+ },
5757+ children: {
5858+ type: 'Snippet',
5959+ description:
6060+ 'The children content to render. The content is displayed when the item is open.',
6161+ required: true
6262+ },
6363+ value: {
6464+ type: 'string',
6565+ description:
6666+ 'The value of the accordion item. This is used to identify when the item is open or closed. If not provided, a unique ID will be generated for this value.'
6767+ },
6868+ disabled: {
6969+ type: 'boolean',
7070+ description: 'Whether the accordion item is disabled.',
7171+ default: 'false'
7272+ },
7373+ ref: {
7474+ type: 'HTMLDivElement',
7575+ description:
7676+ 'The underlying DOM element being rendered. You can bind to this to get a reference to the element.',
7777+ bindable: true
7878+ }
7979+ }
8080+ }
8181+] satisfies APISchema[];
+8-78
apps/docs/src/lib/docs/core/accordion/index.ts
···11-import type { APISchema } from '$lib/types/schema';
21import Docs from './Documentation.md';
32import Example from './Example.svelte';
43import Card from './Card.svelte';
44+import api from './api';
5566export default {
77 slug: 'accordion',
···99 docs: Docs,
1010 example: Example,
1111 card: Card,
1212- api: [
1212+ api,
1313+ sources: [
1314 {
1414- title: 'Accordion',
1515- description:
1616- 'A vertically stacked set of interactive headings that each reveal a section of content.',
1717- props: {
1818- children: {
1919- type: 'Snippet',
2020- description:
2121- 'The children content to render. Should be a list of AccordionItem components.',
2222- required: true
2323- },
2424- type: {
2525- type: { type: 'enum', definition: "'single' | 'multiple'" },
2626- description:
2727- "If set to 'multiple', the accordion will allow multiple items to be open at the same time. If set to single, the accordion will only allow a single item to be open.",
2828- required: true
2929- },
3030- value: {
3131- type: { type: 'union', definition: 'string | string[]' },
3232- description:
3333- 'The value of the accordion item that is currently open. If type is set to "multiple", this will be an array of strings. If type is set to "single", this will be a string.',
3434- bindable: true
3535- },
3636- onValueChange: {
3737- type: {
3838- type: 'function',
3939- definition: '(value: string) => void | (value: string[]) => void'
4040- },
4141- description: 'A function that is called when the value of the accordion item changes.'
4242- },
4343- disabled: {
4444- type: 'boolean',
4545- description: 'Whether the accordion is disabled.',
4646- default: 'false'
4747- },
4848- ref: {
4949- type: 'HTMLDivElement',
5050- description:
5151- 'The underlying DOM element being rendered. You can bind to this to get a reference to the element.',
5252- bindable: true
5353- }
5454- }
5555- },
5656- {
5757- title: 'AccordionItem',
5858- description: 'A single collapsible section within the accordion.',
5959- props: {
6060- title: {
6161- type: 'string',
6262- description:
6363- 'The title of the accordion item, displayed both when the item is closed or open.',
6464- required: true
6565- },
6666- children: {
6767- type: 'Snippet',
6868- description:
6969- 'The children content to render. The content is displayed when the item is open.',
7070- required: true
7171- },
7272- value: {
7373- type: 'string',
7474- description:
7575- 'The value of the accordion item. This is used to identify when the item is open or closed. If not provided, a unique ID will be generated for this value.'
7676- },
7777- disabled: {
7878- type: 'boolean',
7979- description: 'Whether the accordion item is disabled.',
8080- default: 'false'
8181- },
8282- ref: {
8383- type: 'HTMLDivElement',
8484- description:
8585- 'The underlying DOM element being rendered. You can bind to this to get a reference to the element.',
8686- bindable: true
8787- }
8888- }
1515+ href: 'https://bits-ui.com/docs/components/accordion',
1616+ label: 'bits-ui accordion',
1717+ package: 'bits-ui',
1818+ component: 'Accordion'
8919 }
9090- ] satisfies APISchema[]
2020+ ]
9121};
···2233```svelte
44<NumberInput min={0} max={100} bind:value />
55-```
66-77-## Credits
88-99-- Adapted from an example of [number-flow](https://number-flow.barvian.me/)
55+```
···8899## Accessibility
10101111-- If javascript is disabled, the theme toggle will not be shown.
1212-1313-## Credits
1414-1515-Based on [mode-watcher](https://github.com/svecosystem/mode-watcher), also exports all functions and stores from the package.
1111+- If javascript is disabled, the theme toggle will not be shown.