SlopUI.Components.Shell (SlopUI v0.1.0)

Copy Markdown View Source

Application shell: sidebar, topbar, navigation, auth layout, indicator.

Summary

Functions

The page frame: a sidebar (which becomes a sheet on narrow screens), a sticky topbar, and the main area.

A centred panel for sign-in, sign-up, and similar pages.

Wraps a control with a dot or count marker, for notification buttons.

A navigation landmark holding groups of items.

A collapsible navigation group on <details>, for nested sections.

A labelled group of navigation items.

A navigation link. current marks the active page with aria-current. A badge renders a count or status on the right.

The sidebar column: brand, navigation, and a footer pinned to the bottom.

Topbar content helpers: put things at the end of the bar.

Functions

app_shell(assigns)

The page frame: a sidebar (which becomes a sheet on narrow screens), a sticky topbar, and the main area.

<.app_shell id="app">
  <:sidebar>
    <.sidebar brand="Acme" brand_href={~p"/"}>
      <.nav>
        <.nav_group label="Workspace">
          <.nav_item navigate={~p"/"} current={@live_action == :home}><.icon name="folder" /> Projects</.nav_item>
        </.nav_group>
      </.nav>
      <:footer><.button variant="ghost" size="sm">Sign out</.button></:footer>
    </.sidebar>
  </:sidebar>
  <:topbar>
    <.breadcrumbs></.breadcrumbs>
    <:end><.theme_toggle /></:end>
  </:topbar>
  Page content
</.app_shell>

The sidebar slot is rendered once for the desktop column and once inside a sheet for narrow viewports, so avoid ids inside it. Set --sl-sidebar-width and --sl-topbar-height to change the geometry.

Attributes

  • id (:string) (required)
  • width (:string) - content measure. Defaults to "default". Must be one of "default", "narrow", or "wide".
  • class (:any) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • sidebar
  • topbar - Accepts attributes:
    • class (:any)
  • inner_block (required)

auth_layout(assigns)

A centred panel for sign-in, sign-up, and similar pages.

<.auth_layout title="Welcome back" description="Sign in to continue.">
  <:brand><.icon name="folder" /> Acme</:brand>
  <.form ></.form>
  <:footer>New here? <.link navigate={~p"/signup"}>Create an account</.link></:footer>
</.auth_layout>

Attributes

  • title (:string) (required)
  • description (:string) - Defaults to nil.
  • class (:any) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • brand
  • inner_block (required)
  • footer

indicator(assigns)

Wraps a control with a dot or count marker, for notification buttons.

<.indicator count={3}><.button variant="ghost" icon aria-label="Notifications"><.icon name="bell" /></.button></.indicator>
<.indicator dot color="success"><.avatar name="Ada" /></.indicator>

Attributes

  • count (:integer) - Defaults to nil.
  • dot (:boolean) - Defaults to false.
  • max (:integer) - Defaults to 99.
  • color (:string) - Defaults to "danger". Must be one of "danger", "accent", or "success".
  • label (:string) - accessible description of the marker, e.g. "3 unread". Defaults to nil.
  • class (:any) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • inner_block (required)

sidebar(assigns)

The sidebar column: brand, navigation, and a footer pinned to the bottom.

Attributes

  • brand (:string) - Defaults to nil.
  • brand_href (:string) - Defaults to nil.
  • class (:any) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • logo - an icon or image rendered before the brand name.
  • inner_block (required)
  • footer

topbar_end(assigns)

Topbar content helpers: put things at the end of the bar.

Attributes

  • class (:any) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • inner_block (required)