PetalComponents.Accordion (petal_components v4.5.0)

Copy Markdown View Source

Summary

Functions

accordion(assigns)

Attributes

  • container_id (:string)
  • class (:any) - CSS class for parent container. Defaults to nil.
  • entries (:list) - Defaults to [%{}].
  • variant (:string) - default is the shadcn row style (hairline dividers, no boxes); bordered is the boxed card-accordion. ghost is a legacy alias of default (identical look) slated for removal in a future major. Defaults to "default". Must be one of "default", "bordered", or "ghost".
  • size (:string) - sm tightens paddings and type for dense UIs (settings panels, sidebars). Defaults to "md". Must be one of "sm", or "md".
  • open_index (:integer) - Index of item to be open at render. Defaults to nil.
  • multiple (:boolean) - When true, multiple sections can be expanded simultaneously. Defaults to false.
  • on_toggle (Phoenix.LiveView.JS) - additional JS commands to run when an accordion section is toggled (LiveView.JS only). Defaults to %Phoenix.LiveView.JS{ops: []}.
  • Global attributes are accepted.

Slots

  • item (required) - CSS class for parent container. Accepts attributes:
    • heading (:string)