Navigated to /docs/ui/components/collapsible

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.

TSX
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

Use Collapsible for optional details that should open and close without leaving the page, such as advanced settings or supporting explanations.

Choose something else when

Use Dialog or Sheet for focused modal workflows, and Tabs when multiple peer sections switch within one persistent region.

Examples

Collapsible example

TSX
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

PropTypeDefaultDescription
classNamestring

Optional class hook applied to the public root element owned by the component.
openboolean

Configures open for this component.

Complete TypeScript API

Import from @tavojs/ui/collapsible. Published exports: Collapsible, CollapsibleContent, CollapsibleContentProps, CollapsibleProps, CollapsibleRoot, CollapsibleTrigger, CollapsibleTriggerProps.

CollapsibleProps

PropertyTypeRequiredDescription
childrenChild

No

Inherited children attribute accepted by Collapsible.

classNamestring

No

Optional class hook applied to the public root element owned by the component.

sxSx

No

Inherited sx attribute accepted by Collapsible.

idstring

No

Inherited id attribute accepted by Collapsible.

rolestring

No

Inherited role attribute accepted by Collapsible.

styleRecord<string, unknown>

No

Inherited style attribute accepted by Collapsible.

titlestring

No

Inherited title attribute accepted by Collapsible.

tabIndexnumber

No

Inherited tabIndex attribute accepted by Collapsible.

hiddenboolean

No

Inherited hidden attribute accepted by Collapsible.

disabledboolean

No

Inherited disabled attribute accepted by Collapsible.

onClickTavoEventHandler<MouseEvent>

No

Inherited onClick attribute accepted by Collapsible.

onChangeTavoEventHandler<Event>

No

Inherited onChange attribute accepted by Collapsible.

onInputTavoEventHandler<Event>

No

Inherited onInput attribute accepted by Collapsible.

onKeyDownTavoEventHandler<KeyboardEvent>

No

Inherited onKeyDown attribute accepted by Collapsible.

onFocusTavoEventHandler<FocusEvent>

No

Inherited onFocus attribute accepted by Collapsible.

onBlurTavoEventHandler<FocusEvent>

No

Inherited onBlur attribute accepted by Collapsible.

openboolean

No

Configures open for this component.

CollapsibleTriggerProps

PropertyTypeRequiredDescription
childrenChild

No

Inherited children attribute accepted by Collapsible.

classNamestring

No

Optional class hook applied to the public root element owned by the component.

sxSx

No

Inherited sx attribute accepted by Collapsible.

idstring

No

Inherited id attribute accepted by Collapsible.

rolestring

No

Inherited role attribute accepted by Collapsible.

styleRecord<string, unknown>

No

Inherited style attribute accepted by Collapsible.

titlestring

No

Inherited title attribute accepted by Collapsible.

tabIndexnumber

No

Inherited tabIndex attribute accepted by Collapsible.

hiddenboolean

No

Inherited hidden attribute accepted by Collapsible.

disabledboolean

No

Inherited disabled attribute accepted by Collapsible.

onClickTavoEventHandler<MouseEvent>

No

Inherited onClick attribute accepted by Collapsible.

onChangeTavoEventHandler<Event>

No

Inherited onChange attribute accepted by Collapsible.

onInputTavoEventHandler<Event>

No

Inherited onInput attribute accepted by Collapsible.

onKeyDownTavoEventHandler<KeyboardEvent>

No

Inherited onKeyDown attribute accepted by Collapsible.

onFocusTavoEventHandler<FocusEvent>

No

Inherited onFocus attribute accepted by Collapsible.

onBlurTavoEventHandler<FocusEvent>

No

Inherited onBlur attribute accepted by Collapsible.

CollapsibleContentProps

PropertyTypeRequiredDescription
childrenChild

No

Inherited children attribute accepted by Collapsible.

classNamestring

No

Optional class hook applied to the public root element owned by the component.

sxSx

No

Inherited sx attribute accepted by Collapsible.

idstring

No

Inherited id attribute accepted by Collapsible.

rolestring

No

Inherited role attribute accepted by Collapsible.

styleRecord<string, unknown>

No

Inherited style attribute accepted by Collapsible.

titlestring

No

Inherited title attribute accepted by Collapsible.

tabIndexnumber

No

Inherited tabIndex attribute accepted by Collapsible.

hiddenboolean

No

Inherited hidden attribute accepted by Collapsible.

disabledboolean

No

Inherited disabled attribute accepted by Collapsible.

onClickTavoEventHandler<MouseEvent>

No

Inherited onClick attribute accepted by Collapsible.

onChangeTavoEventHandler<Event>

No

Inherited onChange attribute accepted by Collapsible.

onInputTavoEventHandler<Event>

No

Inherited onInput attribute accepted by Collapsible.

onKeyDownTavoEventHandler<KeyboardEvent>

No

Inherited onKeyDown attribute accepted by Collapsible.

onFocusTavoEventHandler<FocusEvent>

No

Inherited onFocus attribute accepted by Collapsible.

onBlurTavoEventHandler<FocusEvent>

No

Inherited onBlur attribute accepted by Collapsible.

State ownership and DOM target

ConcernContract
StateApplication controlled through open and the matching callback.
DOM targetPublic passthrough props target the component root. Treat nested elements and private class names as implementation details.

Anatomy and related components

Public compound members: Root, Trigger, Content

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

ContractCurrent value
Maturitystable
Categorycontent
Component import@tavojs/ui/collapsible
Explicit CSS import@tavojs/ui/css/collapsible
PreviewInteractive preview available on this page