LedgerUI.Components.Shell (LedgerUI v0.2.0)

Copy Markdown View Source

The framed shell of the app with the side menu of sidebar/1: the menu on the grey frame and the page beside it. It is fed by one list of items, so changing sidebar changes the menu and not the items.

<.shell nav={MyAppWeb.Nav.items(assigns)} sidebar="rail" current={@current_path}
  brand={%{name: "Ledger", logo: "S"}} user={@user}>
  <:topbar><.navbar>...</.navbar></:topbar>
  ...the page...
</.shell>

nav, brand, user, plan, trial, rail_extra, footer, version, match, persist_groups, collapsible and collapsed are those of LedgerUI.Components.Sidebar.sidebar/1, which documents the data of the items. sidebar is the format (sections, rail, tree or nested).

The :topbar slot is the row at the top of the page (a navbar/1), the :tab_bar slot is the phone's bottom bar of tabs (a tab_bar/1, shown only below 768px by the LedgerUI.AppShell hook stylesheet).

Preview

variant="preview" draws the canvas wireframe of a layout instead of the app (the docs and the showcase use it): sidebar, minimal, sideblock, horizontal, framed or rail. A box with grey bars for the menu, the top bar and the cards; class takes the animation (m-collapse).

<.shell variant="preview" layout="framed" class="m-collapse" />

Configuration

config :ledger_ui, :shell, sidebar: :sections, nav: {MyAppWeb.Nav, :items}, footer: :version, version: "v1.4.2"

Attributes always win over the config.

Summary

Functions

shell(assigns)

Attributes

  • id (:string) - Defaults to "shell".
  • variant (:string) - Defaults to "app". Must be one of "app", or "preview".
  • layout (:string) - With preview: the wireframe. Defaults to "sidebar". Must be one of "sidebar", "minimal", "sideblock", "horizontal", "framed", or "rail".
  • flat (:boolean) - The items of the menu without the column around them. Defaults to false.
  • sidebar (:any) - Defaults to nil.
  • nav (:list) - Defaults to nil.
  • current (:string) - Defaults to nil.
  • brand (:map) - Defaults to nil.
  • user (:map) - Defaults to nil.
  • footer (:any) - Defaults to nil.
  • show_user (:boolean) - Defaults to nil.
  • version (:any) - Defaults to nil.
  • match (:string) - Defaults to "exact". Must be one of "exact", or "prefix".
  • persist_groups (:boolean) - Defaults to false.
  • plan (:map) - Defaults to nil.
  • trial (:map) - Defaults to nil.
  • rail_extra (:list) - Defaults to [].
  • collapsible (:boolean) - Defaults to true.
  • collapsed (:boolean) - Defaults to false.
  • class (:any) - Defaults to nil.
  • main_class (:any) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • brand_mark
  • inner_block
  • mobile_drawer
  • sidebar_footer
  • tab_bar
  • topbar