Skip to content

Collapsible

Free

One button that shows and hides a panel of content under it.

  • Base UI
  • React 19
  • Tailwind CSS 4

Added Nov 8, 2026 · MIT + Commons Clause

Playground

Loading the preview

Props

Render a Button through render on CollapsibleTrigger. Put the space above the content on CollapsibleContent (className="pt-2"), not as a gap on the root, so the page does not jump.

The sample also uses Button. One command adds them with this item:

advanced-options.tsx

Collapsible

<div>
PropTypeDefaultDescription
classNamestring—
From Base UICollapsible.RootBase UI docs
openboolean—Whether the collapsible panel is currently open. To render an uncontrolled collapsible, use the defaultOpen prop instead.
defaultOpenbooleanfalseWhether the collapsible panel is initially open. To render a controlled collapsible, use the open prop instead.
onOpenChange—Event handler called when the panel is opened or closed.
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

CollapsibleTrigger

<div>
PropTypeDefaultDescription
classNamestring—
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

CollapsibleChevron

<svg>
PropTypeDefaultDescription
direction"down""end"—down (default) for a panel that opens below, end for a row that opens rows under it.
variant"bulk""duotone""solid""stroke""twotone"—stroke (default): 1.5 strokes. solid: the body filled, inner details cut through. duotone: a 40% fill under the stroke. twotone: the details at 40%. bulk: the body filled at 40% with no outline, the details at full color.
corners"round""sharp"—round (default): round caps and joins, soft corners. sharp: square caps, miter joins.
openboolean—Open: the chevron turns (down → up, end → down) on the panelBounce spring.
...props<svg> attributes—Every other attribute goes to the <svg>, with a ref.

CollapsibleContent

<div>
PropTypeDefaultDescription
classNamestring—
From Base UICollapsible.PanelBase UI docs
hiddenUntilFoundbooleanfalseAllows the browser's built-in page search to find and expand the panel contents. Overrides the keepMounted prop and uses hidden="until-found" to hide the element without removing it from the DOM.
keepMountedbooleanfalseWhether to keep the element in the DOM while the panel is hidden. This prop is ignored when hiddenUntilFound is used.
render—Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

AnimatedChevronIcon

<svg>
PropTypeDefaultDescription
direction"down""end""down"down (default) for a panel that opens below, end for a row that opens rows under it.
variant"bulk""duotone""solid""stroke""twotone"—stroke (default): 1.5 strokes. solid: the body filled, inner details cut through. duotone: a 40% fill under the stroke. twotone: the details at 40%. bulk: the body filled at 40% with no outline, the details at full color.
corners"round""sharp"—round (default): round caps and joins, soft corners. sharp: square caps, miter joins.
openbooleanfalseOpen: the chevron turns (down → up, end → down) on the panelBounce spring.
...props<svg> attributes—Every other attribute goes to the <svg>, with a ref.
  • Use it to hide one panel of content until the user asks for it.
  • Render a Button through render on CollapsibleTrigger, and keep its text the same when it opens.
  • Put the space between the trigger and the content on CollapsibleContent (className="pt-2"), so the page does not jump.
  • For content over the page, use a Dialog.
EnterOpens or closes the panel.
SpaceOpens or closes the panel.

CollapsibleTrigger is a Base UI Collapsible.Trigger, a button. Base UI sets aria-expanded on it, and aria-controls to the panel while the panel is open.

Name the trigger by what the panel shows ("Advanced options"). Keep the text the same when it opens: aria-expanded says the state.

Render a Button as the trigger: it then has the focus ring, and on a coarse pointer hit-area grows its touch target to at least 44 × 44px.

Open and close
panel · 260ms · ease-panel (0.2, 0.4, 0.2, 1) · the height and the chevron turn
Content in
fade · 150ms · ease-out (0, 0, 0.2, 1)
Content out
fade-exit · 90ms · ease-out (0, 0, 0.2, 1)

Built with

Installs with Collapsible

  1. AddedCollapsible.
Open the release