SaltDnsWeb.Console.Components (Salt v1.0.0)

Small building blocks of the web console: badges, copy buttons, code blocks, page titles and tabs. They only lay out what they are given; what to show is decided in the SaltDnsWeb.Console.* helpers.

The shared components (header, panel, table, button, input, flash and empty state) are in SaltDnsWeb.CoreComponents; what is here is specific to the console. Colours come from the tokens in assets/css/app.css.

Summary

Functions

A block of preformatted text (a client snippet) with a copy button.

Copies value to the clipboard when clicked. Needs a unique id.

Monospace text with a copy button, for names and values people paste elsewhere.

Closes a panel by hiding it; used by dismissible notices.

The title of a page, with what can be done on it on the right.

A short status label, with the console's atom tones. The tone is never the only sign: the words say it.

Tab links; tabs is a list of {key, label, path}. When they do not fit they scroll sideways: the active tab is brought into view and the edge that has more behind it fades (data-edge is set by the hook).

Functions

code_block(assigns)

A block of preformatted text (a client snippet) with a copy button.

Attributes

  • id (:string) (required)
  • title (:string) (required)
  • body (:string) (required)
  • note (:string) - Defaults to nil.

copy_button(assigns)

Copies value to the clipboard when clicked. Needs a unique id.

Attributes

  • id (:string) (required)
  • value (:string) (required)
  • label (:string) - Defaults to "Copy".
  • class (:any) - Defaults to nil.

copy_line(assigns)

Monospace text with a copy button, for names and values people paste elsewhere.

Attributes

  • id (:string) (required)
  • value (:string) (required)
  • label (:string) - what it is, shown before the value. Defaults to nil.

hide_panel(id)

Closes a panel by hiding it; used by dismissible notices.

page_title(assigns)

The title of a page, with what can be done on it on the right.

Attributes

  • title (:string) (required)
  • mono? (:boolean) - the title is a name or a value. Defaults to false.

Slots

  • subtitle
  • badges
  • actions

status_badge(assigns)

A short status label, with the console's atom tones. The tone is never the only sign: the words say it.

Attributes

  • tone (:atom) - Defaults to :muted. Must be one of :ok, :attention, :muted, :warn, :danger, or :info.
  • Global attributes are accepted.

Slots

  • inner_block (required)

tabs(assigns)

Tab links; tabs is a list of {key, label, path}. When they do not fit they scroll sideways: the active tab is brought into view and the edge that has more behind it fades (data-edge is set by the hook).

Attributes

  • tabs (:list) (required)
  • active (:atom) (required)
  • id (:string) - Defaults to "tabs".