Shell
layout sidebar · minimal · sideblock · horizontal · framed · rail + subnav · recolher
Shell padrão do kit montado como no exemplo: app em moldura arredondada, sidebar à esquerda e conteúdo com cards.
Sidebar recolhendo e abrindo
<div class="grid grid-cols-2 gap-4"> <.shell variant="preview" layout="sidebar" loop /> <.shell variant="preview" layout="framed" loop /> </div>
layout sidebar · minimal · sideblock · horizontal · framed
<div class="grid grid-cols-3 gap-3.5"> <div class="flex flex-col gap-1.5"> <span class="font-mono text-xs text-muted">sidebar</span> <.shell variant="preview" layout="sidebar" /> </div> <div class="flex flex-col gap-1.5"> <span class="font-mono text-xs text-muted">minimal</span> <.shell variant="preview" layout="minimal" /> </div> <div class="flex flex-col gap-1.5"> <span class="font-mono text-xs text-muted">sideblock</span> <.shell variant="preview" layout="sideblock" /> </div> <div class="flex flex-col gap-1.5"> <span class="font-mono text-xs text-muted">horizontal</span> <.shell variant="preview" layout="horizontal" /> </div> <div class="flex flex-col gap-1.5"> <span class="font-mono text-xs text-muted">framed</span> <.shell variant="preview" layout="framed" /> </div> <div class="flex flex-col gap-1.5"> <span class="font-mono text-xs text-muted">rail</span> <.shell variant="preview" layout="rail" /> </div> </div>
Valores da API que completam a paridade
/pedidosmatch=exact/pedidos/*match=prefix<div class="grid grid-cols-8 gap-3.5"> <div class="flex flex-col items-start gap-1.5"><.badge canvas color="success" dot>success</.badge><span class="font-mono text-[11px] text-muted">status=success</span></div> <div class="flex flex-col items-start gap-1.5"><.badge canvas color="warning" dot>warning</.badge><span class="font-mono text-[11px] text-muted">status=warning</span></div> <div class="flex flex-col items-start gap-1.5"><.badge canvas color="error" dot>error</.badge><span class="font-mono text-[11px] text-muted">status=error</span></div> <div class="flex flex-col items-start gap-1.5"><.badge canvas color="info" dot>info</.badge><span class="font-mono text-[11px] text-muted">status=info</span></div> <div class="flex flex-col items-start gap-1.5"><.badge canvas color="neutral" dot>neutral</.badge><span class="font-mono text-[11px] text-muted">status=neutral</span></div> <div class="flex flex-col items-start gap-1.5"><.sidebar_nav_link active color="neutral"><.icon name="grid" size="md" />Item</.sidebar_nav_link><span class="font-mono text-[11px] text-muted">color=neutral</span></div> <div class="flex flex-col items-start gap-1.5"><.sidebar_nav_link active color="secondary"><.icon name="grid" size="md" />Item</.sidebar_nav_link><span class="font-mono text-[11px] text-muted">color=secondary</span></div> <div class="flex flex-col items-start gap-1.5"><.sidebar_nav_link active color="info"><.icon name="grid" size="md" />Item</.sidebar_nav_link><span class="font-mono text-[11px] text-muted">color=info</span></div> <div class="flex flex-col items-start gap-1.5"><.sidebar_nav_link active color="success"><.icon name="grid" size="md" />Item</.sidebar_nav_link><span class="font-mono text-[11px] text-muted">color=success</span></div> <div class="flex flex-col items-start gap-1.5"><.sidebar_nav_link active color="warning"><.icon name="grid" size="md" />Item</.sidebar_nav_link><span class="font-mono text-[11px] text-muted">color=warning</span></div> <div class="flex flex-col items-start gap-1.5"><.sidebar_nav_link active color="error"><.icon name="grid" size="md" />Item</.sidebar_nav_link><span class="font-mono text-[11px] text-muted">color=error</span></div> <div class="flex flex-col items-start gap-1.5"><.chip>default</.chip><span class="font-mono text-[11px] text-muted">variant=default</span></div> <div class="flex flex-col items-start gap-1.5"><.chip>canvas</.chip><span class="font-mono text-[11px] text-muted">variant=canvas</span></div> <div class="flex flex-col items-start gap-1.5"><.switch color="primary" checked aria-label="switch" /><span class="font-mono text-[11px] text-muted">variant=switch</span></div> <div class="flex flex-col items-start gap-1.5"><.inline_code>/pedidos</.inline_code><span class="font-mono text-[11px] text-muted">match=exact</span></div> <div class="flex flex-col items-start gap-1.5"><.inline_code>/pedidos/*</.inline_code><span class="font-mono text-[11px] text-muted">match=prefix</span></div> </div>
shell float no modo slot (:sidebar, :topbar): trilho, subnavegação e main flutuante (antes shell_floating)
<% rows = [
%{av: "PB", name: "Priya Banerjee", age: "32F", mrn: "MRN-0204013", bed: "ED-01", cond: "Shortness of breath", st: "Needs approval", st_c: "warning", risk: "Medium", risk_c: "primary", adm: "4d ago"},
%{av: "SM", name: "Sofia Mensah", age: "31F", mrn: "MRN-0204043", bed: "ED-02", cond: "Syncope", st: "Open", st_c: "neutral", risk: "Low", risk_c: "neutral", adm: "5d ago"},
%{av: "CR", name: "Clara Reyes", age: "81F", mrn: "MRN-0204101", bed: "ED-03", cond: "Chest pain", st: "Open", st_c: "neutral", risk: "Low", risk_c: "neutral", adm: "4d ago"},
%{av: "FH", name: "Felix Hussain", age: "66M", mrn: "MRN-0204161", bed: "ED-06", cond: "Shortness of breath", st: "Needs approval", st_c: "warning", risk: "Medium", risk_c: "primary", adm: "3d ago"},
%{av: "LI", name: "Lucia Ivanova", age: "55F", mrn: "MRN-0204363", bed: "ED-24", cond: "Syncope", st: "Solved", st_c: "success", risk: "Medium", risk_c: "primary", adm: "4d ago"},
%{av: "JN", name: "Jonas Nowak", age: "81M", mrn: "MRN-0204385", bed: "ED-08", cond: "Fever and cough", st: "Open", st_c: "neutral", risk: "High", risk_c: "warning", adm: "5d ago"},
%{av: "EM", name: "Elena Moreau", age: "49F", mrn: "MRN-0204452", bed: "ICU-01", cond: "Acute kidney injury", st: "Needs approval", st_c: "warning", risk: "Critical", risk_c: "error", adm: "2d ago"}
] %>
<.shell float id="shell-float-demo" min_height="900px" class="min-w-[1360px] rounded-2xl border border-line" persist={false}>
<:sidebar>
<.main_sidebar id="rail-float" aria-label="Módulos"><:logo><.icon name="settings" size="lg" /></:logo><:item label="home"><.icon name="home" /></:item><:item label="bot"><.icon name="bot" /></:item><:item label="inbox" active><.icon name="inbox" /></:item><:item label="layers"><.icon name="layers" /></:item><:item label="check-circle" count="8" count_tone="warn"><.icon name="check-circle" /></:item><:item label="logout"><.icon name="logout" /></:item><:item label="history"><.icon name="history" /></:item><:item label="bookmark"><.icon name="bookmark" /></:item><:item label="users"><.icon name="users" /></:item></.main_sidebar>
<.sidebar_panel title="Cases"><.sidebar_nav_link href="#" active><.icon name="list" size="md" />All<:count>60</:count></.sidebar_nav_link><.sidebar_nav_link href="#"><.icon name="package" size="md" />Archived<:count>0</:count></.sidebar_nav_link><.sidebar_nav_heading icon="chevron-down">Status</.sidebar_nav_heading><.sidebar_nav_link href="#"><.icon name="circle" size="md" />New<:count>11</:count></.sidebar_nav_link><.sidebar_nav_link href="#"><.icon name="clock" size="md" />Open<:count>31</:count></.sidebar_nav_link><.sidebar_nav_link href="#"><.icon name="shield" size="md" />Needs approval<:count>7</:count></.sidebar_nav_link><.sidebar_nav_link href="#"><.icon name="check-circle" size="md" />Solved<:count>11</:count></.sidebar_nav_link><.sidebar_nav_link href="#"><.icon name="plus" size="md" />Add Status</.sidebar_nav_link><.sidebar_nav_heading icon="chevron-down">Department</.sidebar_nav_heading><.sidebar_nav_link href="#"><.icon name="alert" size="md" />ED<:count>12</:count></.sidebar_nav_link><.sidebar_nav_link href="#"><.icon name="target" size="md" />ICU<:count>17</:count></.sidebar_nav_link><.sidebar_nav_link href="#"><.icon name="tool" size="md" />Surgery<:count>17</:count></.sidebar_nav_link><.sidebar_nav_link href="#"><.icon name="smile" size="md" />Pediatrics<:count>14</:count></.sidebar_nav_link><.sidebar_nav_link href="#"><.icon name="droplet" size="md" />Pharmacy<:count>2</:count></.sidebar_nav_link><.sidebar_nav_link href="#"><.icon name="plus" size="md" />Add Department</.sidebar_nav_link></.sidebar_panel>
</:sidebar>
<:topbar>
<.navbar>
<.navbar_crumbs variant="plain" items={[%{label: "St. Aurelia General", href: "#"}, %{label: "Cases"}]} />
<:end>
<.navbar_search input kbd="Ctrl K" placeholder="Search or run…" width="280px" class="h-10 rounded-[12px]" />
<.navbar_bell dot tone="warn" label="Notifications" />
<.avatar initials="IS" color="t1" size="md" />
</:end>
</.navbar>
</:topbar>
<.page_header>
<:heading>All cases</:heading>
<:subtitle><b class="font-mono text-ink">60</b> cases. Use the side panel to filter by status or department.</:subtitle>
<:actions>
<.navbar_search input kbd="/" placeholder="Search name, MRN, bed" width="280px" />
<.button><.icon name="plus" />New case</.button>
</:actions>
</.page_header>
<div class="px-7 pb-7">
<.card_table id="float-cases" rows={rows}>
<:col :let={r} label="Patient"><span class="flex flex-nowrap items-center gap-2.5"><.avatar variant="mono" initials={r.av} size="sm" /><span class="text-ink">{r.name}</span><span class="text-muted">{r.age}</span></span></:col>
<:col :let={r} label="MRN"><span class="font-mono">{r.mrn}</span></:col>
<:col :let={r} label="Bed"><span class="font-mono text-ink">{r.bed}</span></:col>
<:col :let={r} label="Condition">{r.cond}</:col>
<:col :let={r} label="Status"><.badge canvas variant="outline" color={r.st_c}>{r.st}</.badge></:col>
<:col :let={r} label="Risk"><.badge canvas variant="outline" color={r.risk_c}>{r.risk}</.badge></:col>
<:col :let={r} label="Admitted" align="right"><span class="font-mono">{r.adm}</span></:col>
</.card_table>
</div>
</.shell>
Uso
<.shell> <:sidebar>…</:sidebar> <:topbar>…</:topbar> … </.shell>
Regras
- Moldura do app com raio 28 e sombra teal suave; conteúdo em
bg-page. - Grid: 4 KPIs · (MRR growth 2fr + Revenue by plan 1fr) · (Movement, Cohort, AI insights).
- Gutter de 16–20px entre cards; padding de página 24px.
- Rodapé discreto com ARPA e aviso de dados gerados.
Referência da API
Todos os function components, atributos, valores e slots que este componente cobre.
The one frame of the app: the side menu, the top bar, the page and the parts that lie over them.
shell/1 draws the menu in one of two ways and keeps the same frame around it.
Data mode: nav
The menu is fed by one list of items (LedgerUI.Components.Sidebar.sidebar/1), so changing
format changes how the menu is drawn and not the items.
<.shell nav={MyAppWeb.Nav.items(assigns)} format="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. format is how it is drawn (sections, rail, tree or
nested).
Slot mode: <:sidebar>
When the :sidebar slot is given, the menu is your markup (the building blocks below: the icon
rail, a panel, the sideblock, the horizontal navigation...) and nav and format are ignored.
layout says which arrangement it is (sidebar, minimal, sideblock, horizontal or framed).
<.shell id="shell" full 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>
<:topbar><.header /></:topbar>
<.page_header title="Avatar">
<:crumb navigate={~p"/elements"}>Elements</:crumb>
<:crumb>Avatar</:crumb>
</.page_header>
</.shell>
The frame (both modes)
The :topbar slot is the row at the top of the page (a navbar/1 or header/1), the :tab_bar
slot is the phone's bottom bar of tabs (a tab_bar/1, shown only below 768px), the :aside slot is
rendered after the page, over the whole shell (a drawer, a right sidebar, a modal).
full makes it a full-screen app (no border, radius or shadow, viewport height) and min_height
sets the minimum height. float makes the page a bordered, rounded card beside the menu (layout="framed"
implies it). preloader covers the shell with a spinner until the hook mounts.
header_sticky and header_blur (the top bar sticks and blurs what scrolls under it) default to
on in slot mode and off in data mode (the navbar/1 scrolls with the page there).
State and the hook
The root is the group/shell of its parts and carries the state other kits keep in <body>
classes: open and is-sidebar-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. The LedgerUI.Shell hook keeps the open state (sidebar_open; by default
open for sidebar and sideblock), persists the user's choice at xl and up (persist,
localStorage["ledger-sidebar"]), closes it below xl, and tells the server through on_toggle
(an event name, pushed to target when given, or a JS command). [data-sidebar-toggle] inside
the shell toggles it (sidebar_toggle/1).
Hooks used: LedgerUI.Shell, LedgerUI.Sidebar (collapsing menus), LedgerUI.RightSidebar,
LedgerUI.Clock and LedgerUI.MonochromeToggle; dark mode is theme_toggle/1 and
theme_script/1 of LedgerUI.Components.ThemeSwitch.
Building blocks
The slot mode is made of the parts of this module, all public function components: the icon rail
(main_sidebar/1, main_sidebar_link/1, sidebar_profile/1, icon_rail/1), the panel
(sidebar_panel/1, sidebar_nav/1, sidebar_nav_link/1, sidebar_nav_group/1, ...), the minimized
panel (sidebar_panel_min/1), sideblock/1, header/1, the horizontal navigation
(horizontal_nav_menu/1), right_sidebar/1, the framed menu (framed_sidebar/1, rail_link/1,
rail_module/1, rail_heading/1, rail_workspace/1, rail_user/1, rail_toggle/1), tab_bar/1,
page_header/1 (it was AppShell.page_header/1) and monochrome_toggle/1.
Styled only with Tailwind utilities (no stylesheet of its own). The root keeps overflow: clip: a
drawer that slides in over it is clipped, and clip (unlike hidden) cannot be scrolled by the
focus the drawer takes. The collapsible menus (framed_sidebar/1, Sidebar) are the group/side
of their parts and read data-collapsed, which the LedgerUI.Sidebar hook sets.
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; loop animates the menu collapsing.
<.shell variant="preview" layout="framed" loop />
Configuration
config :ledger_ui, :shell, sidebar: :sections, nav: {MyAppWeb.Nav, :items}, footer: :version, version: "v1.4.2"
Attributes always win over the config.
<.shell>
| Attr | Type | Default | Values / notes |
|---|---|---|---|
id |
:string |
"shell" |
|
variant |
:string |
"app" |
app, preview |
layout |
:string |
"sidebar" |
sidebar, minimal, sideblock, horizontal, framed, rail - The arrangement of the :sidebar slot (rail is only a wireframe, drawn as sidebar); with preview: the wireframe. |
loop |
:boolean |
false |
With preview: the menu collapses and expands on its own (the showcase demo). |
flat |
:boolean |
false |
Data mode: the items of the menu without the column around them. |
format |
:any |
nil |
Data mode: how the menu is drawn, sections, rail, tree or nested (the format of sidebar/1; it was the sidebar attribute). |
nav |
:list |
nil |
|
current |
:string |
nil |
|
brand |
:map |
nil |
|
user |
:map |
nil |
|
footer |
:any |
nil |
|
show_user |
:boolean |
nil |
|
version |
:any |
nil |
|
match |
:string |
"exact" |
exact, prefix |
persist_groups |
:boolean |
false |
|
plan |
:map |
nil |
|
trial |
:map |
nil |
|
rail_extra |
:list |
[] |
|
collapsible |
:boolean |
true |
|
collapsed |
:boolean |
false |
|
full |
:boolean |
false |
Full-screen app: no border, radius or shadow, and a minimum height of the viewport (100vh) instead of 520px. |
float |
:boolean |
false |
The floating page (a bordered, rounded card beside the menu); layout="framed" implies it. |
min_height |
:string |
nil |
The minimum height of the shell, a CSS length ("900px", "40rem"). Default: 520px, or the viewport with full. |
sidebar_open |
:boolean |
nil |
The open state of the menu (the open / is-sidebar-open classes). Default: open for the sidebar and sideblock layouts. |
persist |
:boolean |
true |
Keep the open state the user chose (xl and up) in localStorage["ledger-sidebar"]. |
on_toggle |
:any |
nil |
An event name pushed with %{"id" => id, "open" => boolean} when the menu opens or closes, or a Phoenix.LiveView.JS command. |
target |
:any |
nil |
The phx-target of the on_toggle event. |
preloader |
:boolean |
false |
A spinner over the shell until it mounts. |
header_sticky |
:boolean |
nil |
The top bar sticks to the top. Default: on in slot mode, off in data mode. |
header_blur |
:boolean |
nil |
The top bar blurs what scrolls under it. Default: on in slot mode, off in data mode. |
class |
:any |
nil |
|
main_class |
:any |
nil |
Any other HTML/phx attribute goes to the root element.
Slots:
<:aside>- Rendered after the page, over the whole shell: a drawer, a modal, a right sidebar.<:brand_mark><:inner_block><:mobile_drawer><:sidebar>- Slot mode: your own menu (the main sidebar and its panel, the sideblock...). With itnavandformatare ignored.<:sidebar_footer><:tab_bar>- A bottom bar of tabs for phones: atab_bar/1.<:topbar>- The row at the top of the page: anavbar/1orheader/1.
<.main_sidebar>
The main sidebar: the icon rail with the logo, the section links and the bottom links.
| Attr | Type | Default | Values / notes |
|---|---|---|---|
id |
:string |
"main-sidebar" |
|
current |
:any |
nil |
The current path (matched against each item's link), or an item's name. |
centered |
:boolean |
false |
|
class |
:any |
nil |
Any other HTML/phx attribute goes to the root element.
Slots:
<:bottom><:item>- attrs:href,navigate,patch,label,icon,name,active,class,style,count,count_tone<:logo>- attrs:href,navigate,patch,src,alt
<.main_sidebar_link>
One icon link of the main sidebar.
| Attr | Type | Default | Values / notes |
|---|---|---|---|
label |
:string |
nil |
The tooltip and the accessible name. |
active |
:boolean |
false |
|
current |
:string |
nil |
|
count |
:any |
nil |
A counter badge on the corner of the button. |
count_tone |
:string |
"neg" |
neg, warn - The color of the counter. |
class |
:any |
nil |
Any other HTML/phx attribute goes to the root element, including href, navigate, patch, method, replace.
Slots:
<:inner_block>(required)
<.sidebar_profile>
The avatar at the bottom of the main sidebar and the profile box it opens on its right.
| Attr | Type | Default | Values / notes |
|---|---|---|---|
id (required) |
:string |
||
src (required) |
:string |
||
alt |
:string |
"avatar" |
|
name (required) |
:string |
||
subtitle |
:string |
nil |
|
status |
:string |
"success" |
nil, `,success,warning,error,info,neutral` |
href |
:string |
nil |
|
navigate |
:string |
nil |
|
class |
:any |
nil |
Any other HTML/phx attribute goes to the root element.
Slots:
<:footer><:item>- attrs:href,navigate,patch,method,color,title,description
<.sidebar_panel>
The sidebar panel next to the main sidebar: its title and the scrolling body.
| Attr | Type | Default | Values / notes |
|---|---|---|---|
title (required) |
:string |
||
class |
:any |
nil |
Any other HTML/phx attribute goes to the root element.
Slots:
<:inner_block>(required)
<.sidebar_nav>
A list of the sidebar panel (or the sideblock).
| Attr | Type | Default | Values / notes |
|---|---|---|---|
class |
:any |
nil |
Any other HTML/phx attribute goes to the root element.
Slots:
<:inner_block>(required)
<.sidebar_nav_link>
A plain link of the sidebar panel, active with active or when its path is current.
| Attr | Type | Default | Values / notes |
|---|---|---|---|
active |
:boolean |
false |
|
current |
:string |
nil |
|
color |
:string |
nil |
nil, neutral, primary, secondary, info, success, warning, error - The active link takes the soft fill and the ink of this color (default: the selected look). |
class |
:any |
nil |
Any other HTML/phx attribute goes to the root element, including href, navigate, patch, method, replace.
Slots:
<:count>- The count (or the key hint) at the end of the link.<:inner_block>(required)
<.sidebar_nav_count>
The count (or the key hint) at the end of a link of the sidebar panel (<:count> of sidebar_nav_link/1 renders it).
| Attr | Type | Default | Values / notes |
|---|---|---|---|
class |
:any |
nil |
Any other HTML/phx attribute goes to the root element.
Slots:
<:inner_block>(required)
<.sidebar_nav_heading>
The title over a group of links of the sidebar panel, with no toggle (sidebar_nav_group/1 is the collapsible one).
| Attr | Type | Default | Values / notes |
|---|---|---|---|
icon |
:string |
nil |
A small icon before the title (chevron-down, as in a group). |
upper |
:boolean |
false |
Mono caps, as the heading of the rail. |
class |
:any |
nil |
Any other HTML/phx attribute goes to the root element.
Slots:
<:inner_block>(required)
<.sidebar_nav_group>
A collapsible group of the sidebar panel. It opens when one of its items is active (or with open).
| Attr | Type | Default | Values / notes |
|---|---|---|---|
id |
:string |
nil |
Defaults to sidebar-group-<label>. |
label (required) |
:string |
||
open |
:boolean |
nil |
|
name |
:string |
"sidebar-nav" |
Groups with the same name open one at a time. |
current |
:string |
nil |
|
class |
:any |
nil |
Any other HTML/phx attribute goes to the root element.
Slots:
<:item>(required) - attrs:href,navigate,patch,active
<.sidebar_nav_divider>
The line between the lists of the sidebar panel.
| Attr | Type | Default | Values / notes |
|---|---|---|---|
class |
:any |
nil |
<.sidebar_panel_min>
The minimized sidebar panel (layout="minimal"): a header, the icon links and a footer.
| Attr | Type | Default | Values / notes |
|---|---|---|---|
class |
:any |
nil |
Any other HTML/phx attribute goes to the root element.
Slots:
<:footer><:header><:inner_block>(required)
<.sidebar_min_group>
A list of icon links of the minimized panel.
| Attr | Type | Default | Values / notes |
|---|---|---|---|
class |
:any |
nil |
Slots:
<:inner_block>(required)
<.sidebar_min_link>
An icon link of the minimized panel. The active one is accent soft.
| Attr | Type | Default | Values / notes |
|---|---|---|---|
label |
:string |
nil |
|
color |
:string |
"neutral" |
neutral, primary, secondary, info, success, warning, error |
active |
:boolean |
false |
|
current |
:string |
nil |
|
class |
:any |
nil |
Any other HTML/phx attribute goes to the root element, including href, navigate, patch, method, replace.
Slots:
<:inner_block>(required)
<.sidebar_min_divider>
The line between the lists of the minimized panel.
| Attr | Type | Default | Values / notes |
|---|---|---|---|
class |
:any |
nil |
<.sideblock>
The sideblock (layout="sideblock"): one wide sidebar with the logo and the navigation.
| Attr | Type | Default | Values / notes |
|---|---|---|---|
class |
:any |
nil |
Any other HTML/phx attribute goes to the root element.
Slots:
<:inner_block>(required)<:logo>- attrs:href,navigate,patch,src,alt
<.header>
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.
| Attr | Type | Default | Values / notes |
|---|---|---|---|
id |
:string |
"app-header" |
|
toggle |
:boolean |
true |
|
search |
:boolean |
true |
|
search_placeholder |
:string |
"Search here..." |
|
search_input |
:map |
%{} |
|
theme_toggle |
:boolean |
true |
|
monochrome_toggle |
:boolean |
true |
|
right_sidebar |
:string |
nil |
|
class |
:any |
nil |
Any other HTML/phx attribute goes to the root element.
Slots:
<:actions><:brand>- attrs:href,navigate,src,label<:mobile_search><:nav><:notifications>- attrs:dot,label<:profile><:search_results><:start>
<.sidebar_toggle>
The animated hamburger: three bars that turn into an arrow while the sidebar is open.
| Attr | Type | Default | Values / notes |
|---|---|---|---|
class |
:any |
nil |
Any other HTML/phx attribute goes to the root element.
<.horizontal_nav_menu>
A dropdown of the horizontal navigation: an icon and a label, and a box of links.
| Attr | Type | Default | Values / notes |
|---|---|---|---|
id (required) |
:string |
||
label (required) |
:string |
||
active |
:boolean |
false |
|
current |
:string |
nil |
|
class |
:any |
nil |
Any other HTML/phx attribute goes to the root element.
Slots:
<:icon><:inner_block><:item>- attrs:href,navigate,patch,active
<.horizontal_nav_link>
A link of a horizontal navigation box. A click closes the box.
| Attr | Type | Default | Values / notes |
|---|---|---|---|
active |
:boolean |
false |
|
current |
:string |
nil |
|
class |
:any |
nil |
Any other HTML/phx attribute goes to the root element, including href, navigate, patch, method, replace.
Slots:
<:inner_block>(required)
<.horizontal_nav_divider>
The line between the links of a horizontal navigation box.
| Attr | Type | Default | Values / notes |
|---|---|---|---|
class |
:any |
nil |
<.right_sidebar>
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.
| Attr | Type | Default | Values / notes |
|---|---|---|---|
id (required) |
:string |
||
open |
:boolean |
false |
|
label |
:string |
"Sidebar" |
|
persist_tab |
:boolean |
false |
|
on_open |
:any |
nil |
|
on_close |
:any |
nil |
|
target |
:any |
nil |
|
class |
:any |
nil |
Any other HTML/phx attribute goes to the root element.
Slots:
<:footer><:inner_block><:title>
<.right_sidebar_toggle>
The header button that toggles a right_sidebar/1.
| Attr | Type | Default | Values / notes |
|---|---|---|---|
target (required) |
:string |
||
class |
:any |
nil |
Any other HTML/phx attribute goes to the root element.
<.framed_sidebar>
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 (the
names, headings and the workspace go away, badges become dots) and the choice is kept in
localStorage. Below 768px it is a top bar with a hamburger.
| Attr | Type | Default | Values / notes |
|---|---|---|---|
id (required) |
:string |
||
collapsed |
:boolean |
false |
|
collapsed_width |
:integer |
nil |
The width of the collapsed rail in px (default 60). Sets --lu-rail-collapsed on the menu; the variable can also be set in CSS. |
persist |
:boolean |
true |
|
on_collapse |
:string |
nil |
|
shortcut |
:string |
"b" |
|
target |
:any |
nil |
|
label |
:string |
"Main menu" |
|
mobile_label |
:string |
"Menu" |
|
class |
:any |
nil |
Any other HTML/phx attribute goes to the root element.
Slots:
<:bottom><:brand><:inner_block>(required)<:search>- attrs:id,class,title,aria-label,phx-click,phx-target<:wordmark><:workspace>
<.tab_bar>
A phone's bottom bar of tabs: one icon per section, the current one in the accent color.
| Attr | Type | Default | Values / notes |
|---|---|---|---|
label |
:string |
"Sections" |
|
current |
:string |
nil |
|
variant |
:string |
"default" |
default, canvas |
match |
:string |
"exact" |
exact, prefix |
class |
:any |
nil |
Any other HTML/phx attribute goes to the root element.
Slots:
<:tab>(required) - attrs:href,navigate,patch,label,active,class,match
<.rail_toggle>
A button that collapses and expands the framed_sidebar/1 with that id, from anywhere.
| Attr | Type | Default | Values / notes |
|---|---|---|---|
for (required) |
:string |
The id of the framed_sidebar/1. |
|
label |
:string |
"Collapse menu" |
|
class |
:any |
nil |
Any other HTML/phx attribute goes to the root element.
Slots:
<:inner_block>
<.rail_link>
A page of the framed menu: the icon, the label, an optional badge and a tooltip for the rail.
| Attr | Type | Default | Values / notes |
|---|---|---|---|
label (required) |
:string |
||
badge |
:string |
nil |
|
variant |
:string |
"default" |
default, sub |
active |
:boolean |
false |
|
current |
:string |
nil |
|
class |
:any |
nil |
Any other HTML/phx attribute goes to the root element, including href, navigate, patch, method, replace.
Slots:
<:inner_block>- The icon (optional in thesubvariant).<:trailing>- Right-aligned content (akbdhint...); hidden when the rail collapses.
<.rail_heading>
A small uppercase title over a group of rail_link/1s; hidden in the rail. mono (default) or sans.
| Attr | Type | Default | Values / notes |
|---|---|---|---|
variant |
:string |
"mono" |
mono, sans |
class |
:any |
nil |
Any other HTML/phx attribute goes to the root element.
Slots:
<:inner_block>(required)
<.rail_module>
A module of the framed menu: a button that opens the pages under it.
| Attr | Type | Default | Values / notes |
|---|---|---|---|
id (required) |
:string |
||
label (required) |
:string |
||
badge |
:string |
nil |
|
open |
:boolean |
nil |
|
current |
:string |
nil |
|
class |
:any |
nil |
Any other HTML/phx attribute goes to the root element.
Slots:
<:icon>(required)<:item>(required) - attrs:navigate,patch,href,active,badge
<.rail_workspace>
The workspace switcher under the brand of the framed menu. It is a button: phx-click opens your list.
| Attr | Type | Default | Values / notes |
|---|---|---|---|
name (required) |
:string |
||
subtitle |
:string |
nil |
|
initials |
:string |
nil |
|
bare |
:boolean |
false |
No margin under the box (for use outside of the menu). |
class |
:any |
nil |
Any other HTML/phx attribute goes to the root element.
Slots:
<:inner_block>
<.rail_user>
The person at the bottom of the framed menu: their picture and, outside the rail, their name.
| Attr | Type | Default | Values / notes |
|---|---|---|---|
name (required) |
:string |
||
subtitle |
:string |
nil |
|
class |
:any |
nil |
Any other HTML/phx attribute goes to the root element.
Slots:
<:inner_block>(required)
<.page_header>
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.
| Attr | Type | Default | Values / notes |
|---|---|---|---|
title |
:string |
nil |
The title text. Or give the :title slot. |
title_class |
:any |
nil |
Classes of the h1 (e.g. an animate-[…] utility for the canvas). |
variant |
:string |
"inline" |
inline, page |
show_heading |
:boolean |
true |
false does not render the h1 (the title, the :heading slot and the inline badge); the crumbs, description and actions stay. |
density |
:string |
"default" |
default, compact - The top padding: default is 26px (pt-[26px]), compact is 24px (pt-6). |
description |
:string |
nil |
|
back |
:string |
nil |
|
back_label |
:string |
nil |
|
badge_position |
:string |
"above" |
above, inline |
clock |
:boolean |
false |
|
locale |
:string |
nil |
|
bell |
:boolean |
false |
|
bell_label |
:string |
"Notifications" |
|
on_bell |
:any |
nil |
|
class |
:any |
nil |
Any other HTML/phx attribute goes to the root element.
Slots:
<:actions><:badge><:crumb>- attrs:href,navigate,patch<:heading>- The content of theh1with markup, instead oftitle.<:icon><:inner_block><:leading><:notifications><:subtitle>- A description with markup, instead ofdescription.<:tabs>
<.monochrome_toggle>
The monochrome mode: the palette button of the header or a switch. It toggles is-monochrome on <body>.
| Attr | Type | Default | Values / notes |
|---|---|---|---|
id |
:string |
"monochrome-toggle" |
|
variant |
:string |
"button" |
button, switch |
on_change |
:any |
nil |
|
target |
:any |
nil |
|
class |
:any |
nil |
Any other HTML/phx attribute goes to the root element.
Slots:
<:inner_block>
<.icon_rail>
Same as main_sidebar/1 (same attributes and slots), under the name the design vitrine uses.
| Attr | Type | Default | Values / notes |
|---|---|---|---|
id |
:string |
"main-sidebar" |
|
current |
:any |
nil |
The current path (matched against each item's link), or an item's name. |
centered |
:boolean |
false |
|
class |
:any |
nil |
Any other HTML/phx attribute goes to the root element.
Slots:
<:bottom><:item>- attrs:href,navigate,patch,label,icon,name,active,class,style<:logo>- attrs:href,navigate,patch,src,alt
<.sub_nav>
The sub navigation next to the icon rail: a title and groups of links that open and close.
<.sub_nav title="Cases">
<:group label="Status">
<.sidebar_nav_link navigate={~p"/cases/open"}>Open</.sidebar_nav_link>
</:group>
</.sub_nav>
| Attr | Type | Default | Values / notes |
|---|---|---|---|
title (required) |
:string |
||
loop |
:boolean |
false |
The canvas loop: the first group closes and opens again, forever. |
class |
:any |
nil |
Any other HTML/phx attribute goes to the root element.
Slots:
<:group>- attrs:label(required),open- A collapsible group under the title: a caption and the links.<:inner_block>- What goes before the groups.