Knit UI
GitHub

Playground

Loading playground…

true
true
false
Playground
<Collapse
  expanded
  orientation="vertical"
  transitionDuration={200}
  transitionTimingFunction="ease"
  animateOpacity
  keepMounted={false}
/>

Examples

Controlled

Toggle the panel open and closed with a button — demonstrates controlled usage.

Loading example…

ControlledSourceStorybook

Default Expanded

Starts fully expanded — no transition required on initial render.

Loading example…

Default ExpandedSourceStorybook

Default Collapsed

Starts fully collapsed — content is unmounted (default keepMounted=false).

Loading example…

Default CollapsedSourceStorybook

Shadows

The inherited shadow elevation ladder — each region rendered open, from xs to xl.

Loading example…

ShadowsSourceStorybook

Keep Mounted

keepMounted keeps the DOM node alive while collapsed; the region is aria-hidden.

Loading example…

Keep MountedSourceStorybook

Horizontal Orientation

Collapses along the horizontal (width) axis instead of the default vertical.

Loading example…

Horizontal OrientationSourceStorybook

No Opacity Animation

Opacity animation disabled — only the size transitions, content stays fully opaque.

Loading example…

No Opacity AnimationSourceStorybook

Styles

Per-slot styles targets individual parts — here the root clip box and content wrapper.

Loading example…

StylesSourceStorybook

Multiple Regions

Multiple independently-controlled collapse regions in a stack.

Loading example…

Multiple RegionsSourceStorybook

Props

PropTypeDefaultDescription
animateOpacityboolean | undefinedtrueCross-fade opacity alongside the size transition.
childrenReactNodeCollapsible content.
disabled systemboolean | undefined
expandedboolean | undefinedtrueExpanded state — drives the open/close transition.
inboolean | undefinedExpanded state. Legacy alias of {@link CollapseProps.expanded}.
keepMountedboolean | undefinedfalseKeep content mounted in the DOM while collapsed (useful for SEO / focus management).
onTransitionEnd(() => void) | undefinedCalled when the transition ends.
onTransitionStart(() => void) | undefinedCalled when the transition starts.
openedboolean | undefinedAlias of {@link CollapseProps.in} matching older Mantine.
orientationCollapseOrientation | undefined
vertical · horizontal
'vertical'Collapse axis — vertical (height) or horizontal (width).
shadow system"xs" | "sm" | "md" | "lg" | "xl" | "xxs" | "xxl" | undefined
styles systemSlotStyles<CollapseStyles> | undefinedUniform per-slot style passthrough — sugar over the composable parts. Slots: `root` / `content`. Explicit inline props win.
theme systemThemeName | null | undefinedApplies a theme to this element
transitionDurationnumber | undefined200Transition duration in milliseconds.
transitionTimingFunctionstring | undefined
ease · linear · ease-in · ease-out · cubic-bezier(0.34,1.56,0.64,1)
'ease'CSS timing function — 'linear' maps to the stripe preset, a cubic-bezier to bouncy.

Style slots

Every part of Collapse can be styled through the styles prop. Explicit props on the component always win over slot styles.

SlotUsage
contentstyles={{ content: { … } }}
rootstyles={{ root: { … } }}
Accessibility & DOM props (2)
PropType
keyKey | null | undefined
refRef<TamaguiElement> | undefined

Plus 497 inherited style props from Box — the full Tamagui/React Native style surface, including token shorthands like p, mx, bg and c. See Tokens for the scales they accept, or the full list.