BB.LiveView.Components (bb_liveview v0.2.4)

View Source

Shared UI components for the BB Dashboard.

Provides reusable function components for building the dashboard interface.

Summary

Functions

Renders a status badge.

Renders a button.

Renders an empty state message.

Renders an error message.

Renders a loading spinner.

Renders a widget card with header and body.

Functions

badge(assigns)

Renders a status badge.

Examples

<.badge variant="success">Armed</.badge>
<.badge variant="danger">Error</.badge>

Attributes

  • variant (:string) - Defaults to "muted". Must be one of "success", "warning", "danger", or "muted".

Slots

  • inner_block (required)

button(assigns)

Renders a button.

Examples

<.button>Click me</.button>
<.button variant="primary" disabled={true}>Submit</.button>

Attributes

  • type (:string) - Defaults to "button".
  • variant (:string) - Defaults to "outline". Must be one of "primary", "danger", or "outline".
  • disabled (:boolean) - Defaults to false.
  • class (:string) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • inner_block (required)

empty_state(assigns)

Renders an empty state message.

Examples

<.empty_state message="No events yet" />

Attributes

  • message (:string) (required)
  • icon (:string) - Defaults to nil.

error_message(assigns)

Renders an error message.

Examples

<.error_message message="Failed to load robot data" />

Attributes

  • message (:string) (required)

spinner(assigns)

Renders a loading spinner.

widget(assigns)

Renders a widget card with header and body.

Examples

<.widget title="Safety">
  <p>Widget content here</p>
</.widget>

<.widget title="Joints" loading={true}>
  <p>Loading...</p>
</.widget>

Attributes

  • title (:string) (required)
  • loading (:boolean) - Defaults to false.
  • class (:string) - Defaults to nil.

Slots

  • inner_block (required)
  • actions