View Source SaladUI.Collapsible (SaladUI v1.0.0-beta.1)

Implementation of Collapsible component for SaladUI framework.

This component allows content to be shown or hidden with smooth animations, accessibility support, and keyboard navigation.

Examples:

<.collapsible id="collapsible-1" open>
  <.collapsible_trigger>
    <.button variant="outline">Show content</.button>
  </.collapsible_trigger>
  <.collapsible_content>
    <p>
      Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor
      incididunt ut labore et dolore magna aliqua.
    </p>
  </.collapsible_content>
</.collapsible>

Summary

Functions

The main collapsible component.

The collapsible content that appears when triggered.

The trigger element that toggles the collapsible content.

Functions

The main collapsible component.

Options

  • :id - Required unique identifier for the collapsible.
  • :open - Whether the collapsible is initially open. Defaults to false.
  • :on-open - Handler for collapsible open event.
  • :on-close - Handler for collapsible close event.
  • :class - Additional CSS classes.

Attributes

  • id (:string) (required) - Unique identifier for the collapsible.
  • open (:boolean) - Whether the collapsible is initially open. Defaults to false.
  • on-open (:any) - Handler for collapsible open event. Defaults to nil.
  • on-close (:any) - Handler for collapsible close event. Defaults to nil.
  • class (:string) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • inner_block (required)
Link to this function

collapsible_content(assigns)

View Source

The collapsible content that appears when triggered.

Attributes

  • class (:string) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • inner_block (required)
Link to this function

collapsible_trigger(assigns)

View Source

The trigger element that toggles the collapsible content.

Attributes

  • class (:string) - Defaults to nil.
  • as (:any) - Defaults to "div".
  • Global attributes are accepted.

Slots

  • inner_block (required)