Slab.Components (Slab v1.0.0)

Copy Markdown View Source

Function components used internally by Slab.

These are public so applications can reuse the same table primitives for hand-rolled tables that need to match the Slab look.

Summary

Functions

Renders a styled checkbox input.

Renders a scrollable <pre><code> block for large values like maps.

Renders one of the SVG icons used by the data table.

Renders a <table> element wrapped in a horizontally-scrollable container.

Renders a <td> element.

Renders a <th> element.

Renders a <tr> element.

Functions

checkbox(assigns)

@spec checkbox(map()) :: Phoenix.LiveView.Rendered.t()

Renders a styled checkbox input.

Attributes

  • name (:string) (required)
  • checked (:boolean) - Defaults to false.
  • Global attributes are accepted.

codeblock(assigns)

@spec codeblock(map()) :: Phoenix.LiveView.Rendered.t()

Renders a scrollable <pre><code> block for large values like maps.

Attributes

  • value (:any) (required)

icon(assigns)

@spec icon(map()) :: Phoenix.LiveView.Rendered.t()

Renders one of the SVG icons used by the data table.

Supported types

  • "check-circle-outline"
  • "x-circle-outline"
  • "chevron-up-outline"
  • "chevron-down-outline"
  • "chevron-left-outline"
  • "chevron-right-outline"
  • "funnel-outline"
  • "bookmark-outline"
  • "clipboard-outline"
  • "view-columns-outline"

Attributes

  • type (:string) (required)
  • class (:any) - Defaults to "h-6 w-6 flex-shrink-0 text-gray-400".

table(assigns)

@spec table(map()) :: Phoenix.LiveView.Rendered.t()

Renders a <table> element wrapped in a horizontally-scrollable container.

Slots

  • :thead - optional table header content
  • :inner_block - table body rows

Slots

  • thead
  • inner_block (required)

td(assigns)

@spec td(map()) :: Phoenix.LiveView.Rendered.t()

Renders a <td> element.

Slots

  • inner_block (required)

th(assigns)

@spec th(map()) :: Phoenix.LiveView.Rendered.t()

Renders a <th> element.

Slots

  • inner_block (required)

tr(assigns)

@spec tr(map()) :: Phoenix.LiveView.Rendered.t()

Renders a <tr> element.

Slots

  • inner_block (required)