LedgerUI.Components.HeroCard (LedgerUI v0.2.0)

Copy Markdown View Source

The hero card: the welcome or the insight at the top of a page. The text on the left (an eyebrow in mono caps with an optional icon, the title, the description, a goal meter or a list of steps, and the actions) and a landscape on the right that fades into the card.

<.hero_card eyebrow="Bem-vindo de volta" title="Metas do trimestre" description="Alinhe a equipe.">
  <:actions>
    <.button color="mono" size="lg"><.icon name="plus" />Novo pedido</.button>
  </:actions>
</.hero_card>

<.hero_card
  eyebrow="Bom dia, Alex"
  title="Novembro está 12% acima de outubro"
  meta="Meta de novembro"
  meta_value="R$ 184 mil de R$ 250 mil"
  meter={74}
  animated
/>

<.hero_card
  eyebrow="Configuração"
  title="Falta pouco para emitir sua primeira NF-e"
  picture="none"
  steps={[
    %{label: "Empresa", state: "done"},
    %{label: "Série e numeração", state: "current"},
    %{label: "Teste"}
  ]}
/>

The picture on the right is the summit landscape (picture="summit", drawn with the --hero-* tokens, so it follows the theme), an <img> (src), the :art slot (your own SVG) or nothing (picture="none"). size="lg" makes the card taller; variant="panel" puts it on the panel color instead of the soft gray and variant="ai" is the soft card with the violet eyebrow (suggestions from the assistant). animated adds the canvas loop (mo-hero): the text rises, the landscape breathes and the meter fills.

hero_summit/1 is the landscape on its own, for other surfaces. Give each one on the page its own id (the gradient ids derive from it).

Summary

Functions

The landscape of hero_card/1: a thin delegate to LedgerUI.Components.Illustration.summit/1 (svg.lu-summit painted with the --hero-* tokens). Decorative: aria-hidden.

Functions

hero_card(assigns)

Attributes

  • eyebrow (:string) - The small mono caps line above the title. Defaults to nil.
  • title (:string) (required)
  • description (:string) - Defaults to nil.
  • src (:string) - The picture on the right (replaces the landscape). Defaults to nil.
  • alt (:string) - Defaults to "".
  • position (:string) - The crop of the picture (object-position). Defaults to "center".
  • picture (:string) - The picture when there is no src nor :art slot. Defaults to "summit". Must be one of "summit", or "none".
  • size (:string) - Defaults to "md". Must be one of "md", or "lg".
  • variant (:string) - Defaults to "soft". Must be one of "soft", "panel", or "ai".
  • heading (:string) - Defaults to "h2". Must be one of "h1", "h2", or "h3".
  • meta (:string) - The label of the goal line (needs meta_value). Defaults to nil.
  • meta_value (:string) - The figures of the goal line, already formatted. Defaults to nil.
  • meter (:integer) - Goal progress, 0 to 100: draws the bar under meta. Defaults to nil.
  • steps (:list) - Chips of a checklist: %{label: "Empresa", state: "done" | "current" | "todo"}. Defaults to [].

  • animated (:boolean) - The canvas loop (mo-hero). Defaults to false.
  • id (:string) - Names the card (aria-labelledby) and prefixes the art. Defaults to nil.
  • class (:any) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • actions
  • art - The picture as markup (an SVG), instead of src.
  • icon - An icon before the eyebrow.
  • inner_block - Under the description: a note, a form, anything of your own.

hero_summit(assigns)

The landscape of hero_card/1: a thin delegate to LedgerUI.Components.Illustration.summit/1 (svg.lu-summit painted with the --hero-* tokens). Decorative: aria-hidden.

Attributes

  • id (:string) - Prefix of the gradient ids (hs-sky...): one per summit on a page. Defaults to "hs".
  • class (:any) - Defaults to nil.
  • Global attributes are accepted.