The application shell: the page frame, the main sidebar (the icon rail), the sidebar panel with its collapsible groups, the minimized panel, the sideblock, the horizontal navigation, the header, the right sidebar, the framed menu, the page header and the mode toggles.
<.app_shell id="shell" sidebar_open={@sidebar_open} on_toggle="sidebar">
<:sidebar>
<.main_sidebar current={@current_path}>
<:logo navigate={~p"/"}><.icon name="grid" /></:logo>
<:item navigate={~p"/dashboards"} label="Dashboards"><.icon name="home" /></:item>
</.main_sidebar>
<.sidebar_panel title="Layouts">
<.sidebar_nav>
<.sidebar_nav_link navigate={~p"/orders"} current={@current_path}>Orders</.sidebar_nav_link>
</.sidebar_nav>
</.sidebar_panel>
</:sidebar>
<:header><.header /></:header>
<.page_header title="Avatar">
<:crumb navigate={~p"/elements"}>Elements</:crumb>
<:crumb>Avatar</:crumb>
</.page_header>
</.app_shell>The state kept in <body> classes by other kits lives on the shell root: is-sidebar-open
(mirrored by the class open, so LedgerUI.open/close/toggle(socket_or_js, "shell") drive it),
has-min-sidebar, navigation:sideblock, navigation:horizontal, is-header-blur and
is-header-not-sticky.
Hooks used: LedgerUI.AppShell, LedgerUI.Sidebar (framed menu), LedgerUI.RightSidebar,
LedgerUI.Clock and LedgerUI.MonochromeToggle; dark mode is theme_toggle/1 and
theme_script/1 of LedgerUI.Components.ThemeSwitch.
Written for the lu-* stylesheet: where it has no class (the right sidebar, the framed rail,
the phone tab bar) the rules live in priv/static/ledger_ui.css, loaded after ledger.css.
Summary
Functions
The menu of the framed shell: the brand, an optional workspace and search, the navigation
(rail_link/1, rail_module/1) and the bottom items. It collapses to a rail of icons (anything
with the class rail-label goes away, badges become dots) and the choice is kept in
localStorage. Below 768px it is a top bar with a hamburger.
The header: the animated sidebar toggle, the search bar, the dark mode and monochrome toggles, the
notifications, the right sidebar toggle and a profile slot. With a :nav slot it is the
horizontal navigation header: the :brand and the navigation row below.
The line between the links of a horizontal navigation box.
A link of a horizontal navigation box. A click closes the box.
A dropdown of the horizontal navigation: an icon and a label, and a box of links.
Same as main_sidebar/1 (same attributes and slots), under the name the design vitrine uses.
The main sidebar: the icon rail with the logo, the section links and the bottom links.
One icon link of the main sidebar.
The monochrome mode: the palette button of the header or a switch. It toggles is-monochrome on <body>.
The title of a page. variant="inline" is the row: title (with the breadcrumb above it), a
description and the :actions at the right, then the :tabs. variant="page" is the framed
shell's title block: a top row (the :leading slot, the crumbs, the clock and the bell) or a
back link, the badge, the title with a context line and the actions, and the tabs.
A small uppercase title over a group of rail_link/1s; hidden in the rail.
A page of the framed menu: the icon, the label, an optional badge and a tooltip for the rail.
A module of the framed menu: a button that opens the pages under it.
A button that collapses and expands the framed_sidebar/1 with that id, from anywhere.
The person at the bottom of the framed menu: their picture and, outside the rail, their name.
The workspace switcher under the brand of the framed menu. It is a button: phx-click opens your list.
A drawer from the right with an overlay, a top row (:title and the close button), the content and
a :footer. Opened with open, right_sidebar_toggle/1 or LedgerUI.open/close/toggle(id); Esc,
the overlay and the close button close it.
The header button that toggles a right_sidebar/1.
Same as app_shell/1 (same attributes and slots), under the name the design vitrine uses.
The line between the lists of the minimized panel.
A list of icon links of the minimized panel.
An icon link of the minimized panel. Active links are accent soft, the others take color.
A list of the sidebar panel (or the sideblock).
The line between the lists of the sidebar panel.
A collapsible group of the sidebar panel. It opens when one of its items is active (or with open).
A plain link of the sidebar panel, active with active or when its path is current.
The sidebar panel next to the main sidebar: its title and the scrolling body.
The minimized sidebar panel (layout="minimal"): a header, the icon links and a footer.
The avatar at the bottom of the main sidebar and the profile box it opens on its right.
The animated hamburger: three bars that turn into an arrow while the sidebar is open.
The sideblock (layout="sideblock"): one wide sidebar with the logo and the navigation.
The sub navigation next to the icon rail: a title and groups of links that open and close.
A phone's bottom bar of tabs: one icon per section, the current one in the accent color.
Functions
Attributes
id(:string) - Defaults to"app-shell".layout(:string) - Defaults to"sidebar". Must be one of"sidebar","minimal","sideblock","horizontal", or"framed".sidebar_open(:boolean) - Defaults tonil.full(:boolean) - Full-screen app (lu-app full): no frame, border, radius or shadow,min-height: 100vh. Without it the non-framed layouts carry the same reset inline. Defaults tofalse.header_blur(:boolean) - Defaults totrue.header_sticky(:boolean) - Defaults totrue.persist(:boolean) - Defaults totrue.preloader(:boolean) - Defaults tofalse.on_toggle(:any) - Defaults tonil.target(:any) - Defaults tonil.main_class(:any) - Defaults tonil.class(:any) - Defaults tonil.- Global attributes are accepted.
Slots
The menu of the framed shell: the brand, an optional workspace and search, the navigation
(rail_link/1, rail_module/1) and the bottom items. It collapses to a rail of icons (anything
with the class rail-label goes away, badges become dots) and the choice is kept in
localStorage. Below 768px it is a top bar with a hamburger.
Attributes
id(:string) (required)collapsed(:boolean) - Defaults tofalse.persist(:boolean) - Defaults totrue.on_collapse(:string) - Defaults tonil.shortcut(:string) - Defaults to"b".target(:any) - Defaults tonil.label(:string) - Defaults to"Main menu".mobile_label(:string) - Defaults to"Menu".class(:any) - Defaults tonil.- Global attributes are accepted.
Slots
bottombrandinner_block(required)search- Accepts attributes:id(:string)class(:string)title(:string)aria-label(:string)phx-click(:any)phx-target(:any)
wordmarkworkspace
The header: the animated sidebar toggle, the search bar, the dark mode and monochrome toggles, the
notifications, the right sidebar toggle and a profile slot. With a :nav slot it is the
horizontal navigation header: the :brand and the navigation row below.
Attributes
id(:string) - Defaults to"app-header".toggle(:boolean) - Defaults totrue.search(:boolean) - Defaults totrue.search_placeholder(:string) - Defaults to"Search here...".search_input(:map) - Defaults to%{}.theme_toggle(:boolean) - Defaults totrue.monochrome_toggle(:boolean) - Defaults totrue.right_sidebar(:string) - Defaults tonil.class(:any) - Defaults tonil.- Global attributes are accepted.
Slots
actionsmobile_searchbrand- Accepts attributes:href(:string)navigate(:string)src(:string)label(:string)
navnotifications- Accepts attributes:dot(:boolean)label(:string)
profilesearch_resultsstart
Same as main_sidebar/1 (same attributes and slots), under the name the design vitrine uses.
Attributes
id(:string) - Defaults to"main-sidebar".current(:any) - The current path (matched against each item's link), or an item'sname. Defaults tonil.centered(:boolean) - Defaults tofalse.class(:any) - Defaults tonil.- Global attributes are accepted.
Slots
bottomitem- Accepts attributes:href(:string)navigate(:string)patch(:string)label(:string)icon(:string) - The name of the icon the link shows (or put it in the slot).name(:any) - Marks the item as active whencurrentis this name.active(:boolean)class(:any)style(:string)
logo- Accepts attributes:href(:string)navigate(:string)patch(:string)src(:string)alt(:string)
The main sidebar: the icon rail with the logo, the section links and the bottom links.
Attributes
id(:string) - Defaults to"main-sidebar".current(:any) - The current path (matched against each item's link), or an item'sname. Defaults tonil.centered(:boolean) - Defaults tofalse.class(:any) - Defaults tonil.- Global attributes are accepted.
Slots
bottomitem- Accepts attributes:href(:string)navigate(:string)patch(:string)label(:string)icon(:string) - The name of the icon the link shows (or put it in the slot).name(:any) - Marks the item as active whencurrentis this name.active(:boolean)class(:any)style(:string)
logo- Accepts attributes:href(:string)navigate(:string)patch(:string)src(:string)alt(:string)
One icon link of the main sidebar.
Attributes
label(:string) - The tooltip and the accessible name. Defaults tonil.active(:boolean) - Defaults tofalse.current(:string) - Defaults tonil.class(:any) - Defaults tonil.- Global attributes are accepted. Supports all globals plus:
["href", "navigate", "patch", "method", "replace"].
Slots
inner_block(required)
The monochrome mode: the palette button of the header or a switch. It toggles is-monochrome on <body>.
Attributes
id(:string) - Defaults to"monochrome-toggle".variant(:string) - Defaults to"button". Must be one of"button", or"switch".on_change(:any) - Defaults tonil.target(:any) - Defaults tonil.class(:any) - Defaults tonil.- Global attributes are accepted.
Slots
inner_block
The title of a page. variant="inline" is the row: title (with the breadcrumb above it), a
description and the :actions at the right, then the :tabs. variant="page" is the framed
shell's title block: a top row (the :leading slot, the crumbs, the clock and the bell) or a
back link, the badge, the title with a context line and the actions, and the tabs.
Attributes
title(:string) - The title text. Or give the:titleslot. Defaults tonil.title_class(:any) - Classes of theh1(the canvas animates it withmo-stg). Defaults tonil.variant(:string) - Defaults to"inline". Must be one of"inline", or"page".description(:string) - Defaults tonil.back(:string) - Defaults tonil.back_label(:string) - Defaults tonil.badge_position(:string) - Defaults to"above". Must be one of"above", or"inline".clock(:boolean) - Defaults tofalse.locale(:string) - Defaults tonil.bell(:boolean) - Defaults tofalse.bell_label(:string) - Defaults to"Notifications".on_bell(:any) - Defaults tonil.class(:any) - Defaults tonil.- Global attributes are accepted.
Slots
actionsbadgecrumb- Accepts attributes:href(:string)navigate(:string)patch(:string)
iconinner_blockleadingnotificationssubtitle- A description with markup, instead ofdescription.tabsheading- The content of theh1with markup, instead oftitle.
A small uppercase title over a group of rail_link/1s; hidden in the rail.
Attributes
class(:any) - Defaults tonil.- Global attributes are accepted.
Slots
inner_block(required)
A page of the framed menu: the icon, the label, an optional badge and a tooltip for the rail.
Attributes
label(:string) (required)badge(:string) - Defaults tonil.active(:boolean) - Defaults tofalse.current(:string) - Defaults tonil.class(:any) - Defaults tonil.- Global attributes are accepted. Supports all globals plus:
["href", "navigate", "patch", "method", "replace"].
Slots
inner_block(required)
A module of the framed menu: a button that opens the pages under it.
Attributes
id(:string) (required)label(:string) (required)badge(:string) - Defaults tonil.open(:boolean) - Defaults tonil.current(:string) - Defaults tonil.class(:any) - Defaults tonil.- Global attributes are accepted.
Slots
icon(required)item(required) - Accepts attributes:navigate(:string)patch(:string)href(:string)active(:boolean)
A button that collapses and expands the framed_sidebar/1 with that id, from anywhere.
Attributes
for(:string) (required) - The id of theframed_sidebar/1.label(:string) - Defaults to"Collapse menu".class(:any) - Defaults tonil.- Global attributes are accepted.
Slots
inner_block
The person at the bottom of the framed menu: their picture and, outside the rail, their name.
Attributes
name(:string) (required)subtitle(:string) - Defaults tonil.class(:any) - Defaults tonil.- Global attributes are accepted.
Slots
inner_block(required)
The workspace switcher under the brand of the framed menu. It is a button: phx-click opens your list.
Attributes
name(:string) (required)subtitle(:string) - Defaults tonil.initials(:string) - Defaults tonil.class(:any) - Defaults tonil.- Global attributes are accepted.
Slots
inner_block
A drawer from the right with an overlay, a top row (:title and the close button), the content and
a :footer. Opened with open, right_sidebar_toggle/1 or LedgerUI.open/close/toggle(id); Esc,
the overlay and the close button close it.
Attributes
id(:string) (required)open(:boolean) - Defaults tofalse.label(:string) - Defaults to"Sidebar".persist_tab(:boolean) - Defaults tofalse.on_open(:any) - Defaults tonil.on_close(:any) - Defaults tonil.target(:any) - Defaults tonil.class(:any) - Defaults tonil.- Global attributes are accepted.
Slots
footerinner_blocktitle
The header button that toggles a right_sidebar/1.
Attributes
target(:string) (required)class(:any) - Defaults tonil.- Global attributes are accepted.
Same as app_shell/1 (same attributes and slots), under the name the design vitrine uses.
Attributes
id(:string) - Defaults to"app-shell".layout(:string) - Defaults to"sidebar". Must be one of"sidebar","minimal","sideblock","horizontal", or"framed".sidebar_open(:boolean) - Defaults tonil.full(:boolean) - Full-screen app (lu-app full): no frame, border, radius or shadow,min-height: 100vh. Without it the non-framed layouts carry the same reset inline. Defaults tofalse.header_blur(:boolean) - Defaults totrue.header_sticky(:boolean) - Defaults totrue.persist(:boolean) - Defaults totrue.preloader(:boolean) - Defaults tofalse.on_toggle(:any) - Defaults tonil.target(:any) - Defaults tonil.main_class(:any) - Defaults tonil.class(:any) - Defaults tonil.- Global attributes are accepted.
Slots
The line between the lists of the minimized panel.
Attributes
class(:any) - Defaults tonil.
A list of icon links of the minimized panel.
Attributes
class(:any) - Defaults tonil.
Slots
inner_block(required)
An icon link of the minimized panel. Active links are accent soft, the others take color.
Attributes
label(:string) - Defaults tonil.color(:string) - Defaults to"neutral". Must be one of"neutral","primary","secondary","info","success","warning", or"error".active(:boolean) - Defaults tofalse.current(:string) - Defaults tonil.class(:any) - Defaults tonil.- Global attributes are accepted. Supports all globals plus:
["href", "navigate", "patch", "method", "replace"].
Slots
inner_block(required)
The sidebar panel next to the main sidebar: its title and the scrolling body.
Attributes
title(:string) (required)class(:any) - Defaults tonil.- Global attributes are accepted.
Slots
inner_block(required)
The minimized sidebar panel (layout="minimal"): a header, the icon links and a footer.
Attributes
class(:any) - Defaults tonil.- Global attributes are accepted.
Slots
footerheaderinner_block(required)
The avatar at the bottom of the main sidebar and the profile box it opens on its right.
Attributes
id(:string) (required)src(:string) (required)alt(:string) - Defaults to"avatar".name(:string) (required)subtitle(:string) - Defaults tonil.status(:string) - Defaults to"success". Must be one ofnil,"","success","warning","error","info", or"neutral".href(:string) - Defaults tonil.navigate(:string) - Defaults tonil.class(:any) - Defaults tonil.- Global attributes are accepted.
Slots
footeritem- Accepts attributes:href(:string)navigate(:string)patch(:string)method(:string)color(:string)title(:string)description(:string)
The animated hamburger: three bars that turn into an arrow while the sidebar is open.
Attributes
class(:any) - Defaults tonil.- Global attributes are accepted.
The sideblock (layout="sideblock"): one wide sidebar with the logo and the navigation.
Attributes
class(:any) - Defaults tonil.- Global attributes are accepted.
Slots
inner_block(required)logo- Accepts attributes:href(:string)navigate(:string)patch(:string)src(:string)alt(:string)
A phone's bottom bar of tabs: one icon per section, the current one in the accent color.
Attributes
label(:string) - Defaults to"Sections".current(:string) - Defaults tonil.variant(:string) - Defaults to"default". Must be one of"default", or"canvas".match(:string) - Defaults to"exact". Must be one of"exact", or"prefix".class(:any) - Defaults tonil.- Global attributes are accepted.
Slots
tab(required) - Accepts attributes:href(:string)navigate(:string)patch(:string)label(:string)active(:boolean)class(:string)match(:string)