A section that opens and closes under its trigger, with LineOne's 200ms height animation. It is
the piece LineOne's Collapse and Accordion pages are built from (see LineaUI.Components.Accordion).
<.collapse id="details">
<:trigger class="flex items-center justify-between py-4 font-medium">Shipping details</:trigger>
<p>Ships in two days.</p>
</.collapse>chevron adds the rotating chevron LineOne's panels use at the end of the trigger:
<.collapse id="files" open chevron="down">
<:trigger class="px-4 text-xs font-medium uppercase">My files</:trigger>
…
</.collapse>It is a native <details>: the trigger works with the mouse and the keyboard and the browser
owns open, which survives patches. When the server changes open, the server wins.
LineaUI.open/close/toggle("details") (and their socket forms) open and close it too, and
on_open / on_close run on every toggle; as event names they push %{"id" => id} to the
LiveView (or target).
Summary
Functions
Renders a collapsible section.
Functions
Renders a collapsible section.
<.collapse id="faq-1" open on_close="faq-closed">
<:trigger>Can I pay later?</:trigger>
Yes, within 30 days.
</.collapse>Events: on_open and on_close push %{"id" => id} when they are event names.
Attributes
id(:string) (required)open(:boolean) - Defaults tofalse.on_open(:any) - An event name or a%JS{}. Defaults tonil.on_close(:any) - An event name or a%JS{}. Defaults tonil.target(:any) - Thephx-targetofon_open/on_closeevents. Defaults tonil.chevron(:string) - Draws a chevron at the end of the trigger (which becomes a flex row withjustify-between).downturns upside down while open,rightturns down. Defaults tonil. Must be one ofnil,"down", or"right".chevron_class(:any) - Merged into the chevron's<svg>. Defaults tonil.class(:any) - Merged into the<details>. Defaults tonil.- Global attributes are accepted.
Slots
trigger(required) - Accepts attributes:class(:any) - Classes of the<summary>.
inner_block(required)