{"slug":"collapsible","name":"Collapsible","category":"Layout & Navigation","summary":"A single section that expands to reveal content.","status":"stable","since":"0.2.0","import":"import { Collapsible } from '@elluzion/iv-ui';","usage":["Use for one-off disclosure; use `Accordion` when sections form a set.","`open` is bindable; `defaultOpen` sets the uncontrolled initial state.","`trigger` replaces the default title and chevron content."],"props":[{"name":"title","type":"string","default":"''","description":"Trigger text.","required":false,"bindable":false},{"name":"open","type":"boolean","default":null,"description":"Open state. Bind with `bind:open`.","required":false,"bindable":true},{"name":"defaultOpen","type":"boolean","default":"false","description":"Open on first render when uncontrolled.","required":false,"bindable":false},{"name":"disabled","type":"boolean","default":"false","description":"Disables interaction and applies the disabled treatment.","required":false,"bindable":false},{"name":"className","type":"string","default":"''","description":"Extra classes merged onto the root element.","required":false,"bindable":false}],"events":[{"name":"change","type":"(e: CustomEvent<{ open: boolean }>) => void","default":null,"description":"Called with `{ open }` after the panel toggles.","required":false,"bindable":false}],"snippets":[{"name":"trigger","type":"Snippet","default":null,"description":"Custom trigger content.","required":false,"bindable":false},{"name":"children","type":"Snippet","default":null,"description":"Content rendered inside the component.","required":true,"bindable":false}],"types":[],"manual":[],"tokens":["--iv_border","--iv_ease-out","--iv_font-ui","--iv_foreground","--iv_foreground-dim","--iv_leading-base","--iv_outline-width","--iv_radius","--iv_spacing-lg","--iv_spacing-md","--iv_surface-overlay","--iv_surface-raised","--iv_text-body","--iv_text-btn","--iv_transition-fast","--iv_weight-medium"],"cssHooks":["iv-chevron","iv-collapsible","iv-open","iv-panel","iv-trigger","iv-trigger-label"],"accessibility":{"keyboard":[["Tab","Moves focus to the trigger."],["Enter / Space","Opens or closes the section."]],"notes":["The trigger is a native button with `aria-expanded` and `aria-controls`.","The panel uses `role=\"region\"` and is labelled by the trigger.","Animation is skipped when reduced motion is requested."]},"related":[{"title":"Accordion","summary":"A stack of collapsible sections; one or several can be open.","url":"/components/accordion","kind":"Component"},{"title":"Card","summary":"A bordered surface for grouped content and actions.","url":"/components/card","kind":"Component"},{"title":"Tabs","summary":"Switches between panels that share one context.","url":"/components/tabs","kind":"Component"},{"title":"Separator","summary":"A hairline rule that separates content.","url":"/components/separator","kind":"Component"}],"examples":[{"id":"basic","title":"Basic","description":"A titled section that starts closed.","code":"<script lang=\"ts\">\n\timport { Collapsible } from '@elluzion/iv-ui';\n</script>\n\n<Collapsible title=\"Request headers\">\n\t<pre class=\"code\">accept: application/json\nx-request-id: 8f2c1a</pre>\n</Collapsible>\n\n<style>\n\t.code {\n\t\tmargin: 0;\n\t\tfont-family: var(--iv_font-mono);\n\t\tfont-size: var(--iv_text-sm);\n\t\tcolor: var(--iv_foreground-dim);\n\t}\n</style>"},{"id":"controlled","title":"Controlled","description":"Bind `open` and drive it from outside the component.","code":"<script lang=\"ts\">\n\timport { Button, Collapsible } from '@elluzion/iv-ui';\n\n\tlet open = $state(false);\n</script>\n\n<div class=\"stack\">\n\t<Collapsible title=\"Advanced options\" bind:open>\n\t\t<p>Timeout, retry budget, and the cache policy for this route.</p>\n\t</Collapsible>\n\t<div class=\"row\">\n\t\t<Button size=\"sm\" variant=\"outline\" onclick={() => (open = true)}>Open</Button>\n\t\t<Button size=\"sm\" variant=\"ghost\" onclick={() => (open = false)}>Close</Button>\n\t</div>\n</div>\n\n<style>\n\t.stack {\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\tgap: var(--iv_spacing-md);\n\t}\n\n\t.row {\n\t\tdisplay: flex;\n\t\tgap: var(--iv_spacing-sm);\n\t}\n</style>"},{"id":"custom-trigger","title":"Custom trigger","description":"The trigger snippet replaces the title with custom content.","code":"<script lang=\"ts\">\n\timport { IconTerminal2 } from '@tabler/icons-svelte';\n\timport { Collapsible, Shortcut } from '@elluzion/iv-ui';\n</script>\n\n<Collapsible defaultOpen>\n\t{#snippet trigger()}\n\t\t<span class=\"trigger\">\n\t\t\t<IconTerminal2 size={14} />\n\t\t\tConsole\n\t\t\t<Shortcut keys={['⌘', 'K']} />\n\t\t</span>\n\t{/snippet}\n\t<p>Open the command palette with the shortcut shown above.</p>\n</Collapsible>\n\n<style>\n\t.trigger {\n\t\tdisplay: inline-flex;\n\t\talign-items: center;\n\t\tgap: var(--iv_spacing-sm);\n\t}\n</style>"}],"markdown":"/components/collapsible.md","page":"/components/collapsible"}