Skip to main content

Starwind UI v1.15 is now available! With new prose, sidebar, and more components

Collapsible

@starwind-ui starred 3 repositories

astro

Installation

Usage

General Notes

The Collapsible component provides a way to show and hide content with a trigger button. It’s useful for FAQs, expandable sections, and progressive disclosure patterns.

The essential components are Collapsible, CollapsibleTrigger, and CollapsibleContent.

API Reference

Collapsible

The root container that manages the collapsible state.

PropTypeDefault
defaultOpenbooleanfalse
disabledbooleanfalse
classstring-
<Collapsible defaultOpen>
<CollapsibleTrigger>Toggle</CollapsibleTrigger>
<CollapsibleContent>Content</CollapsibleContent>
</Collapsible>

Additional Notes:

  • defaultOpen: When true, the collapsible content is visible on initial render
  • disabled: When true, the trigger cannot be clicked and the state cannot be changed

CollapsibleTrigger

The button that toggles the collapsible content visibility.

PropTypeDefault
asChildbooleanfalse
classstring-
<CollapsibleTrigger asChild>
<Button variant="ghost">Toggle</Button>
</CollapsibleTrigger>

Additional Notes:

  • asChild: When true, renders as a wrapper div allowing a custom trigger element as a child

CollapsibleContent

The container for content that will be shown or hidden.

PropTypeDefault
classstring-
<CollapsibleContent class="space-y-2">
<p>Hidden content goes here</p>
</CollapsibleContent>

Changelog

v1.0.0

  • Initial release with starwind v1.15.0