Collapsible
A collapsible panel controlled by a button.
Anatomy
Import the primitives and assemble the parts:
@using Blazix.Primitives
<CollapsibleRoot>
<CollapsibleTrigger />
<CollapsiblePanel />
</CollapsibleRoot>Examples
Hidden until found
The HiddenUntilFound parameter hides the closed panel with
hidden="until-found",
so the browser can search its contents with find-in-page (Ctrl+F, or Cmd+F
on macOS) and open the panel when it finds a match. The closed panel always stays in the DOM, which also makes its
contents indexable by search engines.
Older browsers that don't support hidden="until-found" keep the panel hidden until its trigger opens it,
and find-in-page skips over the contents.
<CollapsibleRoot>
<CollapsibleTrigger>Shipping details</CollapsibleTrigger>
<CollapsiblePanel HiddenUntilFound="true">Standard shipping takes 3–5 business days.</CollapsiblePanel>
</CollapsibleRoot>See the Accordion example for an interactive demo.
API Reference
CollapsibleRoot
Renders a <div> element.
Other attributes are passed to the element it renders.
CollapsibleTrigger
Renders a <button> element.
Other attributes are passed to the element it renders.
CollapsiblePanel
Renders a <div> element.
Other attributes are passed to the element it renders.