Collapsible
Native details/summary disclosure for progressively revealing secondary content.
Preview
A live, theme-aware example rendered with the published component.
Loading preview…
Import
Import the component from its dedicated entry point to keep the dependency and generated bundle explicit.
tsximport { Collapsible } from "@tavojs/ui/collapsible";Normal Tavo.js applications load component styles through the Tavo.js UI plugin. If the application manages component CSS manually, also import @tavojs/ui/css/collapsible.
When to use
Use it when
Choose something else when
Examples
Collapsible example
tsximport { Collapsible } from "@tavojs/ui/collapsible";
export function CollapsibleExample1() {
return (
<>
<Collapsible open>
<Collapsible.Trigger>Advanced settings</Collapsible.Trigger>
<Collapsible.Content>Developer-only controls.</Collapsible.Content>
</Collapsible>
</>
);
}Common props and defaults
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Optional class hook applied to the public root element owned by the component. |
open | boolean | — | Configures open for this component. |
Complete TypeScript API
Import from @tavojs/ui/collapsible. Published exports: Collapsible, CollapsibleContent, CollapsibleContentProps, CollapsibleProps, CollapsibleRoot, CollapsibleTrigger, CollapsibleTriggerProps.
CollapsibleProps
| Property | Type | Required | Description |
|---|---|---|---|
children | Child | No | Inherited children attribute accepted by Collapsible. |
className | string | No | Optional class hook applied to the public root element owned by the component. |
sx | Sx | No | Inherited sx attribute accepted by Collapsible. |
id | string | No | Inherited id attribute accepted by Collapsible. |
role | string | No | Inherited role attribute accepted by Collapsible. |
style | Record<string, unknown> | No | Inherited style attribute accepted by Collapsible. |
title | string | No | Inherited title attribute accepted by Collapsible. |
tabIndex | number | No | Inherited tabIndex attribute accepted by Collapsible. |
hidden | boolean | No | Inherited hidden attribute accepted by Collapsible. |
disabled | boolean | No | Inherited disabled attribute accepted by Collapsible. |
onClick | TavoEventHandler<MouseEvent> | No | Inherited onClick attribute accepted by Collapsible. |
onChange | TavoEventHandler<Event> | No | Inherited onChange attribute accepted by Collapsible. |
onInput | TavoEventHandler<Event> | No | Inherited onInput attribute accepted by Collapsible. |
onKeyDown | TavoEventHandler<KeyboardEvent> | No | Inherited onKeyDown attribute accepted by Collapsible. |
onFocus | TavoEventHandler<FocusEvent> | No | Inherited onFocus attribute accepted by Collapsible. |
onBlur | TavoEventHandler<FocusEvent> | No | Inherited onBlur attribute accepted by Collapsible. |
open | boolean | No | Configures open for this component. |
CollapsibleTriggerProps
| Property | Type | Required | Description |
|---|---|---|---|
children | Child | No | Inherited children attribute accepted by Collapsible. |
className | string | No | Optional class hook applied to the public root element owned by the component. |
sx | Sx | No | Inherited sx attribute accepted by Collapsible. |
id | string | No | Inherited id attribute accepted by Collapsible. |
role | string | No | Inherited role attribute accepted by Collapsible. |
style | Record<string, unknown> | No | Inherited style attribute accepted by Collapsible. |
title | string | No | Inherited title attribute accepted by Collapsible. |
tabIndex | number | No | Inherited tabIndex attribute accepted by Collapsible. |
hidden | boolean | No | Inherited hidden attribute accepted by Collapsible. |
disabled | boolean | No | Inherited disabled attribute accepted by Collapsible. |
onClick | TavoEventHandler<MouseEvent> | No | Inherited onClick attribute accepted by Collapsible. |
onChange | TavoEventHandler<Event> | No | Inherited onChange attribute accepted by Collapsible. |
onInput | TavoEventHandler<Event> | No | Inherited onInput attribute accepted by Collapsible. |
onKeyDown | TavoEventHandler<KeyboardEvent> | No | Inherited onKeyDown attribute accepted by Collapsible. |
onFocus | TavoEventHandler<FocusEvent> | No | Inherited onFocus attribute accepted by Collapsible. |
onBlur | TavoEventHandler<FocusEvent> | No | Inherited onBlur attribute accepted by Collapsible. |
CollapsibleContentProps
| Property | Type | Required | Description |
|---|---|---|---|
children | Child | No | Inherited children attribute accepted by Collapsible. |
className | string | No | Optional class hook applied to the public root element owned by the component. |
sx | Sx | No | Inherited sx attribute accepted by Collapsible. |
id | string | No | Inherited id attribute accepted by Collapsible. |
role | string | No | Inherited role attribute accepted by Collapsible. |
style | Record<string, unknown> | No | Inherited style attribute accepted by Collapsible. |
title | string | No | Inherited title attribute accepted by Collapsible. |
tabIndex | number | No | Inherited tabIndex attribute accepted by Collapsible. |
hidden | boolean | No | Inherited hidden attribute accepted by Collapsible. |
disabled | boolean | No | Inherited disabled attribute accepted by Collapsible. |
onClick | TavoEventHandler<MouseEvent> | No | Inherited onClick attribute accepted by Collapsible. |
onChange | TavoEventHandler<Event> | No | Inherited onChange attribute accepted by Collapsible. |
onInput | TavoEventHandler<Event> | No | Inherited onInput attribute accepted by Collapsible. |
onKeyDown | TavoEventHandler<KeyboardEvent> | No | Inherited onKeyDown attribute accepted by Collapsible. |
onFocus | TavoEventHandler<FocusEvent> | No | Inherited onFocus attribute accepted by Collapsible. |
onBlur | TavoEventHandler<FocusEvent> | No | Inherited onBlur attribute accepted by Collapsible. |
State ownership and DOM target
| Concern | Contract |
|---|---|
| State | Application controlled through open and the matching callback. |
| DOM target | Public passthrough props target the component root. Treat nested elements and private class names as implementation details. |
Anatomy and related components
Limitations
Use Dialog or Sheet for focused modal workflows, and Tabs when multiple peer sections switch within one persistent region.
Use only the documented props, entry points, and compound members. Internal DOM nesting and CSS class names can change without becoming part of the public component contract.
Accessibility
Built on native `details` and `summary`.
Built on native `details` and `summary`.
Component status
| Contract | Current value |
|---|---|
| Maturity | stable |
| Category | content |
| Component import | @tavojs/ui/collapsible |
| Explicit CSS import | @tavojs/ui/css/collapsible |
| Preview | Interactive preview available on this page |