Collapsible
An interactive component that can be expanded or collapsed.
A collapsible is a component that allows you to show and hide content. It consists of a trigger button and a content section that can be expanded or collapsed.
Click the trigger button to toggle the visibility of the content. The component manages its open/closed state internally and provides smooth animations for expanding and collapsing.
Yes! You can customize the appearance using CSS classes and style props. The component uses data attributes for styling hooks, making it easy to create custom designs while maintaining accessibility.
A collapsible is a component that allows you to show and hide content. It consists of a trigger button and a content section that can be expanded or collapsed.
Click the trigger button to toggle the visibility of the content. The component manages its open/closed state internally and provides smooth animations for expanding and collapsing.
Yes! You can customize the appearance using CSS classes and style props. The component uses data attributes for styling hooks, making it easy to create custom designs while maintaining accessibility.
import { Collapsible } from '@fintech-sandpit/ui/react';
return ( <Collapsible.Root defaultOpen> <Collapsible.Trigger> What is a collapsible?
<Collapsible.Indicator /> </Collapsible.Trigger>
<Collapsible.Content> A collapsible is a component that allows you to show and hide content. </Collapsible.Content> </Collapsible.Root>
<Collapsible.Root> <Collapsible.Trigger> How does it work?
<Collapsible.Indicator /> </Collapsible.Trigger>
<Collapsible.Content> Click the trigger button to toggle the visibility of the content. </Collapsible.Content> </Collapsible.Root>
<Collapsible.Root> <Collapsible.Trigger> Can I customize it?
<Collapsible.Indicator /> </Collapsible.Trigger>
<Collapsible.Content> Yes! You can customize the appearance using CSS classes and style props. </Collapsible.Content> </Collapsible.Root>);<script setup lang="ts">import { Collapsible } from '@fintech-sandpit/ui/vue';</script>
<template> <Collapsible.Root default-open> <Collapsible.Trigger> What is a collapsible?
<Collapsible.Indicator /> </Collapsible.Trigger>
<Collapsible.Content> A collapsible is a component that allows you to show and hide content. </Collapsible.Content> </Collapsible.Root>
<Collapsible.Root> <Collapsible.Trigger> How does it work?
<Collapsible.Indicator /> </Collapsible.Trigger>
<Collapsible.Content> Click the trigger button to toggle the visibility of the content. </Collapsible.Content> </Collapsible.Root>
<Collapsible.Root> <Collapsible.Trigger> Can I customize it?
<Collapsible.Indicator /> </Collapsible.Trigger>
<Collapsible.Content> Yes! You can customize the appearance using CSS classes and style props. </Collapsible.Content> </Collapsible.Root></template>| Name | Type | Default | Description |
|---|---|---|---|
open | boolean | false | Controlled open state |
defaultOpen | boolean | false | Whether the collapsible is open by default |
disabled | boolean | false | Whether the collapsible is disabled |
| Name | Type | Default | Description |
|---|---|---|---|
open | boolean | false | Controlled open state |
default-open | boolean | false | Whether the collapsible is open by default |
disabled | boolean | false | Whether the collapsible is disabled |
Events
Section titled “Events”| Name | Type | Description |
|---|---|---|
onOpenChange | (value: OpenChangeDetails) => void | Callback fired when the open state changes |
| Name | Type | Description |
|---|---|---|
open-change | (value: OpenChangeDetails) => void | Event emitted when the open state changes |
type OpenChangeDetails = { open: boolean;}