Component changelog

Collapsible changelog

Component-specific release notes collected from the full changelog. This page filters the published entries that mention Collapsible.

Release

v1.0.0

npm
Patch Changes
  • 10dbaf0: Document Collapsible keyboard interactions and ARIA references.

  • 3406f13: fix(collapsible): publish measured content dimensions when forceMounted

    With forceMount, CollapsiblePrimitive.Content is already present, so in the zero-duration branch both setHeight(undefined) and setIsPresent(true) bail out as no-ops and no re-render is scheduled. The measurement from that pass lives only in refs, so the measured size never reached the CSS variables and --radix-collapsible-content-height / --rad-collapsible-content-height were left at their initial 0.

    That matters most under prefers-reduced-motion, where the resolved transition duration is 0 — so the affected path is the default for those users:

    <CollapsiblePrimitive.Root defaultOpen>
      <CollapsiblePrimitive.Content forceMount>…</CollapsiblePrimitive.Content>
    </CollapsiblePrimitive.Root>

    Before, the content height variable read 0px; it now reads the measured height.

  • db4c358: Collapsible primitives respect prefers-reduced-motion

    Adds a usePrefersReducedMotion hook and uses it to resolve the Collapsible height transition.

    transitionDuration was previously defaulted to 300 in CollapsiblePrimitive.Root, which meant the content type could not tell "the consumer asked for 300ms" apart from "nobody asked for anything". The default is removed and the value is resolved in CollapsiblePrimitiveContent:

    const resolvedTransitionDuration =
      transitionDuration !== undefined
        ? transitionDuration
        : prefersReducedMotion
        ? 0
        : DEFAULT_TRANSITION_DURATION;

    So an unset transitionDuration now collapses the animation entirely when prefers-reduced-motion: reduce is set, rather than still animating for 300ms. An explicit transitionDuration always wins, which is the escape hatch for anyone who needs to keep animating.

    The hook is SSR-safe: it returns false until mounted, then follows the media query, and supports both addEventListener and the legacy addListener APIs.

    Note that transitionDuration on CollapsiblePrimitiveRootProps is unchanged for consumers — it was already optional at the prop level; only the internal default is gone.