View Source Backpex.HTML.Layout (Backpex v0.6.0)

Contains all Backpex layout components.

Summary

Components

Renders an app shell representing the base of your layout.

Get the Backpex logo SVG.

Renders flash messages.

Renders a footer. It provides a default look when no content is provided.

Container to wrap main elements and add margin.

Renders a title.

Renders a sidebar item. It uses Phoenix.Component.link/1 component, so you can can use link and href navigation.

Renders a sidebar section.

Renders a topbar.

Renders the topbar branding.

Renders a topbar dropdown.

Functions

Renders the form label and input with corresponding margin and alignment.

Attributes

  • text (:string) - text of the label.

Attributes

  • title (:string) - modal title. Defaults to nil.
  • target (:string) - live component for the close event to go to. Defaults to nil.
  • close_event_name (:string) - close event name. Defaults to "close-modal".
  • max_width (:string) - modal max width. Defaults to "md".
  • open (:boolean) - modal open. Defaults to true.
  • Global attributes are accepted.

Slots

  • inner_block

Filters fields by certain panel.

Components

Renders an app shell representing the base of your layout.

Attributes

  • fluid (:boolean) - toggles fluid layout. Defaults to false.

Slots

  • inner_block
  • topbar - content to be displayed in the topbar. Accepts attributes:
    • class (:string) - additional class that will be added to the component.
  • sidebar - content to be displayed in the sidebar. Accepts attributes:
    • class (:string) - additional class that will be added to the component.
  • footer - content to be displayed in the footer.

Get the Backpex logo SVG.

Attributes

  • class (:string) - class that will be added to the SVG element. Defaults to nil.

Renders flash messages.

Attributes

Renders a footer. It provides a default look when no content is provided.

Attributes

  • class (:string) - additional class that will be added to the component. Defaults to "".

Slots

  • inner_block

Container to wrap main elements and add margin.

Attributes

  • class (:string) - additional class that will be added to the component. Defaults to "".

Slots

  • inner_block

Renders a title.

Attributes

  • class (:string) - additional class that will be added to the component. Defaults to "".

Slots

  • inner_block

Renders a topbar.

Attributes

  • class (:string) - additional class to be added to the component. Defaults to "".

Slots

  • inner_block
Link to this function

topbar_branding(assigns)

View Source

Renders the topbar branding.

Attributes

  • class (:string) - additional class that will be added to the component. Defaults to "".
  • title (:string) - title that will be displayed next to the logo. Defaults to "Backpex".
  • hide_title (:boolean) - if the title should be hidden. Defaults to false.

Slots

  • logo - the logo of the branding.
Link to this function

topbar_dropdown(assigns)

View Source

Renders a topbar dropdown.

Attributes

  • class (:string) - additional class that will be added to the component. Defaults to "".

Slots

  • label (required) - label of the dropdown.

Functions

Link to this function

field_container(assigns)

View Source

Renders the form label and input with corresponding margin and alignment.

Attributes

  • class (:string) - extra classes to be added. Defaults to "".

Slots

  • label (required) - Accepts attributes:
    • align (:atom) - Must be one of :top, :center, or :bottom.
  • inner_block
Link to this function

hide_modal(target \\ nil, close_event)

View Source

Attributes

  • text (:string) - text of the label.

Attributes

  • title (:string) - modal title. Defaults to nil.
  • target (:string) - live component for the close event to go to. Defaults to nil.
  • close_event_name (:string) - close event name. Defaults to "close-modal".
  • max_width (:string) - modal max width. Defaults to "md".
  • open (:boolean) - modal open. Defaults to true.
  • Global attributes are accepted.

Slots

  • inner_block
Link to this function

visible_fields_by_panel(fields, panel, assigns)

View Source

Filters fields by certain panel.

Examples

iex> Backpex.HTML.Layout.visible_fields_by_panel([field1: %{panel: :default}, field2: %{panel: :panel}], :default, nil)
[field1: %{panel: :default}]

iex> Backpex.HTML.Layout.visible_fields_by_panel([field1: %{panel: :default, visible: fn _assigns -> false end}, field2: %{panel: :panel}], :default, nil)
[]

iex> Backpex.HTML.Layout.visible_fields_by_panel([field1: %{panel: :default}], :panel, nil)
[]