PhoenixKitEcommerce.Web.Components.SettingRows (PhoenixKitEcommerce v0.5.0)

Copy Markdown View Source

Rows for the admin settings cards: a title and its explanation on the left, the control on the right.

Mirrors the row layout core uses on its own settings pages (Languages, Crawlers): a plain flex row, font-medium title, muted explanation. The daisyUI 5 label / fieldset-legend classes are deliberately not used here — label is an inline-flex, muted text style meant for a single input caption, and fieldset-legend styles a <legend>; stacking them around a paragraph of explanation greys the whole row out and stops the control from reaching the right edge.

Summary

Functions

A setting whose control is not a toggle — a link, a button group, a small form — passed as the inner block.

A setting with an on/off toggle. The whole row is the label, so clicking the text flips the toggle too.

Functions

setting_row(assigns)

A setting whose control is not a toggle — a link, a button group, a small form — passed as the inner block.

Attributes

  • id (:string) - Defaults to nil.
  • title (:string) (required)
  • description (:string) - Defaults to nil.
  • note (:string) - Defaults to nil.
  • class (:string) - Defaults to nil.

Slots

  • inner_block (required) - The control(s), rendered on the right.

setting_toggle(assigns)

A setting with an on/off toggle. The whole row is the label, so clicking the text flips the toggle too.

event is pushed on click; use rest for phx-value-* attributes.

Attributes

  • id (:string) - DOM id of the checkbox (tests target it). Defaults to nil.
  • title (:string) (required)
  • description (:string) - Defaults to nil.
  • note (:string) - Smaller third line, e.g. a caveat. Defaults to nil.
  • checked (:boolean) (required)
  • event (:string) (required)
  • toggle_class (:string) - daisyUI toggle colour class. Defaults to "toggle-primary".
  • class (:string) - Extra classes on the row. Defaults to nil.
  • Global attributes are accepted.