Base UITransitions
Collapsible
Same preset name as Radix, different mechanism underneath. The consumer never picks which. This is the host that made the height version fail everywhere but Chromium: its panel sits at height auto while open and idle, and auto to zero cannot interpolate.
Every value the manifest allows on this host, single presets and the pairs that compose. The first is what this component ships with. Both stages are the same component, so anything that changes between them is the attribute.
data-open / data-closed, plus data-ending-style
[data-motion~="collapse"][data-ending-style] { grid-template-rows: 0fr }
transition: grid-template-rows 150ms
<Collapsible.Panel data-motion="collapse" />
Where the attribute goes
The parts this demo composes, and the value each one carries. Everything inside an animated part is that part's content, so the tree stops there.
Collapsible.RootCollapsible.TriggerCollapsible.Paneldata-motion="collapse"
Source
"use client"
import { Collapsible } from "@base-ui/react/collapsible"
import type { DemoProps } from "@/components/demos/props"
export function BaseUiCollapsible({ motion }: DemoProps) {
return (
<Collapsible.Root>
<Collapsible.Trigger className="btn">Toggle panel</Collapsible.Trigger>
<Collapsible.Panel data-motion={motion}>
<div className="panel" style={{ marginTop: 12 }}>
<p className="panel__body">
The same preset as Radix, on the transition path instead of the keyframe one. The
single child is what gets clipped.
</p>
</div>
</Collapsible.Panel>
</Collapsible.Root>
)
}motion prop is the only difference between them.