LedgerUI.Components.AuthSplit (LedgerUI v0.2.0)

Copy Markdown View Source

The sign in and sign up screen in two halves, as the canvas draws it: on the left a centered column (the brand mark, the title and subtitle, the :providers buttons and the divider, the form and a line under it) and, on the right, either a picture filling its half with a testimonial over its lower part or the :aside panel (tray background, content centered: a badge, a headline, a KPI card).

<.auth_split title="Criar conta" subtitle="Preencha seus dados." src={~p"/images/auth.jpg"}>
  <:brand><img src={~p"/images/logo.svg"} width="28" /> Acme</:brand>
  <:providers>
    <.oauth_button provider="google" href={~p"/auth/google"}>Google</.oauth_button>
  </:providers>
  <.form for={@form} phx-submit="save">...</.form>
  <:quote author="Marina Costa" role="Gerente" rating={5}>Em uma semana a equipe inteira estava usando.</:quote>
  <:footer>Já tem conta? <.link navigate={~p"/users/log-in"}>Entrar</.link></:footer>
</.auth_split>

The picture is src or the :art slot; without either and without :aside, the form takes the whole card. variant: card (default, the framed app lu-app) or full (the whole screen). The :brand slot is the content of the 40px brand tile (brand_href makes it a link); oauth_button takes block for the full-width provider button of the canvas. For the canvas-v2 screen (brand tile, tinted art with floating cards) see auth_page/1 and auth_art/1. Under 1024px the right half goes away. The other states of the screen: auth_sent/1 (link sent), auth_alert/1 (errors) and auth_submit/1 (sending).

Summary

Functions

The notice on top of a form with errors: a cross icon and the message (role="alert").

The art half of auth_page/1: the mountain landscape (lu-summit), floating :chip cards and a glass :quote. The landscape paints with the --hero-* tokens of .lu-auth .art, so it follows the light and dark themes.

The sign in / sign up / recovery screen of the canvas (lu-auth): on the left the brand, a centered column (max 380px, inner_block) and a footer line; on the right the rounded art (:art, see auth_art/1). It fills its parent (height: 100%), so give the parent the screen's height.

The "link sent" block: a tile with a mail icon and the message beside it (role="status").

The form's submit button, full width and accent. With loading it disables itself and shows the spinner.

A sign in button for an identity provider: the icon and the label, as a link (href) or a button.

Functions

auth_alert(assigns)

The notice on top of a form with errors: a cross icon and the message (role="alert").

Attributes

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

Slots

  • inner_block (required)

auth_art(assigns)

The art half of auth_page/1: the mountain landscape (lu-summit), floating :chip cards and a glass :quote. The landscape paints with the --hero-* tokens of .lu-auth .art, so it follows the light and dark themes.

Attributes

  • id (:string) - Prefix of the SVG's gradient ids; one per page. Defaults to "auth-art".
  • tone (:string) - Modifier of lu-summit (the palette). Defaults to "teal".
  • class (:any) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • chip - A floating card over the picture (top, right in px or any CSS length). Accepts attributes:
    • top (:string)
    • right (:string)
    • left (:string)
    • bottom (:string)
  • quote - The glass testimonial at the bottom. Accepts attributes:
    • author (:string) (required)
    • role (:string)
    • initials (:string)
    • tone (:string) - Avatar tone, t1..t5.

auth_page(assigns)

The sign in / sign up / recovery screen of the canvas (lu-auth): on the left the brand, a centered column (max 380px, inner_block) and a footer line; on the right the rounded art (:art, see auth_art/1). It fills its parent (height: 100%), so give the parent the screen's height.

<.auth_page brand="Ledger">
  <h1>Entrar no Ledger</h1>
  <p class="sub">Pedidos, notas e financeiro num lugar só.</p>
  ...fields...
  <:footer><span>© 2026 Acme</span><span>Privacidade · Termos</span></:footer>
  <:art><.auth_art id="login-art">...</.auth_art></:art>
</.auth_page>

With on_submit or on_change the column is a <form> (the layout is the same), so the fields validate and submit through LiveView.

Inside the column use <h1>, <p class="sub"> and a <div class="or">ou com e-mail</div> divider: lu-auth styles them. The art goes away under the grid's narrow width by CSS.

Attributes

  • brand (:string) - The product name beside the mark. Defaults to "Ledger".
  • mark (:string) - The letter (or text) inside the brand tile. Defaults to "L".
  • form_id (:string) - Id of the column's <form> (with on_submit/on_change). Defaults to nil.
  • on_submit (:any) - Makes the column (.in) a <form> with this phx-submit. Defaults to nil.
  • on_change (:any) - Makes the column (.in) a <form> with this phx-change. Defaults to nil.
  • class (:any) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • inner_block (required) - The form column (.in): title, fields, buttons.
  • footer - The line under the column: one <span> per side (copyright, links).
  • art - The right half (.art); usually auth_art/1.

auth_sent(assigns)

The "link sent" block: a tile with a mail icon and the message beside it (role="status").

Attributes

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

Slots

  • icon
  • inner_block (required)

auth_split(assigns)

Attributes

  • title (:string) (required)
  • subtitle (:string) - Defaults to nil.
  • src (:string) - Defaults to nil.
  • alt (:string) - Defaults to "".
  • variant (:string) - Defaults to "card". Must be one of "card", or "full".
  • glow (:boolean) - Deprecated: the canvas has no glow; ignored. Defaults to false.
  • divider_label (:string) - Defaults to "Or".
  • brand_href (:string) - Makes the brand mark a link. Defaults to nil.
  • class (:any) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • art
  • aside
  • brand
  • footer
  • inner_block (required)
  • providers
  • quote - Accepts attributes:
    • author (:string)
    • role (:string)
    • rating (:integer)

auth_submit(assigns)

The form's submit button, full width and accent. With loading it disables itself and shows the spinner.

Attributes

  • loading (:boolean) - Defaults to false.
  • loading_label (:string) - Defaults to nil.
  • type (:string) - Defaults to "submit".
  • class (:any) - Defaults to nil.
  • Global attributes are accepted. Supports all globals plus: ["disabled", "form", "name", "value"].

Slots

  • inner_block (required)

oauth_button(assigns)

A sign in button for an identity provider: the icon and the label, as a link (href) or a button.

Attributes

  • provider (:string) - Defaults to nil.Must be one of nil, "", "google", "apple", or "github".
  • href (:string) - Defaults to nil.
  • block (:boolean) - The full-width provider button (lu-btn block lg). Defaults to false.
  • class (:any) - Defaults to nil.
  • Global attributes are accepted. Supports all globals plus: ["type", "disabled", "form", "name", "value"].

Slots

  • icon
  • inner_block (required)