LedgerUI.Components.Typography (LedgerUI v0.2.0)

Copy Markdown View Source

Ledger UI's type scale: headings, running text, text links, inline code and keyboard keys.

<.heading level={1}>Heading H1</.heading>
<.heading level={1} size="title">Financeiro</.heading>
<.heading display={2}>Display 2</.heading>

<.text size="lg" color="subtle">Contas a pagar e a receber.</.text>
<.text as="span" mono color="ink">R$ 3.120,50</.text>
<.text as="span" size="lg" weight="semibold" gradient="sky-blue">Gradient</.text>
<.text_link href="#" decoration_color="info" decoration_style="wavy">Tattooine</.text_link>

Press <.kbd>Ctrl</.kbd> + <.kbd>K</.kbd>, or run <.inline_code>mix test</.inline_code>.

Sizes, weights and colours are emitted as inline font-*/color declarations that read the design tokens (var(--ink), var(--muted)...), so they follow the theme. Every attr left at nil emits nothing and the text inherits.

Colours: default inherits, ink/fg are the primary text, neutral is ink-2, muted, subtle/faint the secondary and meta greys, primary the accent ink, and success/warning/error/info/secondary the signal colours.

text defaults weight to nil (inherit); an explicit "normal" sets font-weight:400.

Summary

Functions

A heading, <h1> to <h6>. display renders the display headings (an <h1> unless level says otherwise); size sets the type size apart from the level; size="title" is the page title (34/40, semibold, ink).

Code inside running text: mono 12.5px on the fill colour, in the primary text colour.

A keyboard key (lu-kbd).

A run of text, a paragraph unless as says otherwise.

A link inside running text, underlined (1px) in a theme colour and style. It keeps the weight of the text around it. With href, navigate or patch.

Same as text/1 (same attributes and slots), under the name the design vitrine uses.

Functions

heading(assigns)

A heading, <h1> to <h6>. display renders the display headings (an <h1> unless level says otherwise); size sets the type size apart from the level; size="title" is the page title (34/40, semibold, ink).

Attributes

  • level (:integer) - Defaults to nil.Must be one of nil, 1, 2, 3, 4, 5, or 6.
  • size (:string) - Defaults to nil.Must be one of nil, "2xl", "3xl", "base", "lg", "sm", "title", or "xl".
  • display (:integer) - Defaults to nil.Must be one of nil, 1, 2, 3, 4, or 5.
  • weight (:string) - Defaults to nil.Must be one of nil, "normal", "light", "medium", "semibold", or "bold".
  • color (:string) - Defaults to "default". Must be one of "default", "error", "faint", "fg", "info", "ink", "muted", "neutral", "primary", "secondary", "subtle", "success", or "warning".
  • class (:any) - Defaults to nil.
  • style (:string) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • inner_block (required)

inline_code(assigns)

Code inside running text: mono 12.5px on the fill colour, in the primary text colour.

Attributes

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

Slots

  • inner_block (required)

kbd(assigns)

A keyboard key (lu-kbd).

Attributes

  • variant (:string) - flat has no shadow, on the sunken fill; dark is for dark surfaces (tooltip, toast). Defaults to "raised". Must be one of "raised", "flat", or "dark".
  • class (:any) - Defaults to nil.
  • style (:string) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • inner_block (required)

text(assigns)

A run of text, a paragraph unless as says otherwise.

meta is the 12.5px meta/help line, lead the line under a page title.

Attributes

  • as (:string) - Defaults to "p". Must be one of "p", "span", "div", "strong", "em", or "small".
  • size (:string) - Defaults to "inherit". Must be one of "inherit", "xs", "xs-plus", "sm", "base", "lg", "xl", "meta", or "lead".
  • weight (:string) - Defaults to nil.Must be one of nil, "normal", "light", "medium", "semibold", or "bold".
  • color (:string) - Defaults to "default". Must be one of "default", "error", "faint", "fg", "info", "ink", "muted", "neutral", "primary", "secondary", "subtle", "success", or "warning".
  • mono (:boolean) - Defaults to false.
  • gradient (:string) - Defaults to nil.Must be one of nil, "sky-blue", "green-fuchsia", "fuchsia-pink", "amber-orange", or "purple-indigo".
  • decoration (:string) - Defaults to nil.Must be one of nil, "underline", "overline", "line-through", or "none".
  • class (:any) - Defaults to nil.
  • style (:string) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • inner_block (required)

text_link(assigns)

A link inside running text, underlined (1px) in a theme colour and style. It keeps the weight of the text around it. With href, navigate or patch.

Attributes

  • decoration_color (:string) - Defaults to "current". Must be one of "current", "primary", "secondary", "info", "success", "warning", or "error".
  • decoration_style (:string) - Defaults to "solid". Must be one of "solid", "wavy", "double", "dotted", or "dashed".
  • class (:any) - Defaults to nil.
  • style (:string) - Defaults to nil.
  • Global attributes are accepted. Supports all globals plus: ["href", "navigate", "patch", "method", "download", "target", "rel", "replace"].

Slots

  • inner_block (required)

typography(assigns)

Same as text/1 (same attributes and slots), under the name the design vitrine uses.

Attributes

  • as (:string) - Defaults to "p". Must be one of "p", "span", "div", "strong", "em", or "small".
  • size (:string) - Defaults to "inherit". Must be one of "inherit", "xs", "xs-plus", "sm", "base", "lg", "xl", "meta", or "lead".
  • weight (:string) - Defaults to nil.Must be one of nil, "normal", "light", "medium", "semibold", or "bold".
  • color (:string) - Defaults to "default". Must be one of "default", "error", "faint", "fg", "info", "ink", "muted", "neutral", "primary", "secondary", "subtle", "success", or "warning".
  • mono (:boolean) - Defaults to false.
  • gradient (:string) - Defaults to nil.Must be one of nil, "sky-blue", "green-fuchsia", "fuchsia-pink", "amber-orange", or "purple-indigo".
  • decoration (:string) - Defaults to nil.Must be one of nil, "underline", "overline", "line-through", or "none".
  • class (:any) - Defaults to nil.
  • style (:string) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • inner_block (required)