Browse documentation

Primitives

Use labels, icons, surfaces, and spacing to compose the structure of a screen.

Import

Load the optional component layer before using the examples below.

Ruby
require "zaniah/ui"

Example

These building blocks are intentionally small. Place them inside Div layouts or higher-level components.

Rendered example
Labels, icon, badge, avatar, shortcut label, skeleton, and empty state rendered in a Zaniah card.
Rendered by Zaniah's headless backend.
Ruby
Zaniah::UI::Card.new(
  Zaniah::UI::Label.new("Profile", size: :lg),
  Zaniah::UI::Avatar.new("Ruby UI"),
  Zaniah::UI::Divider.new,
  Zaniah::UI::Kbd.new("ctrl-shift-p")
)

Empty and loading states

Use EmptyState when there is no content to show; give the user a next action. Use Skeleton while content is loading.

Ruby
Zaniah::UI::EmptyState.new(
  "No results", message: "Try another query"
)
Zaniah::UI::Skeleton.new(width: 180, height: 20)

API summary

Constructor options and behaviors are drawn from the component reference.

ComponentConstructor and methodsVariants or behavior
Label(text, tone:, size:, wrap:)tone: default/muted/inverse; size: xs–xl
Icon(source, size:, color:, label:)bundled: check/close/search/menu/info/warning
Divider(axis:)horizontal/vertical
Spacer(size = nil)fixed or flexible
Card(*children), childtheme surface
Kbd(keys, platform:); .for(action, keymap:)OS shortcut notation, including multi-stroke bindings
Avatar(name, image:, size:)initials or PNG
Skeleton(width:, height:)pulsing loading placeholder
EmptyState(title, message:, icon:, action:)compositional

Accessibility

Give an Icon a label: when it conveys information; decorative icons do not need one.

ComponentSemantic role
Labeltext
Iconimage when labeled
Dividerseparator
Spacernone
Cardgroup
Kbdtext
Avatarimage
Skeletonprogressbar/busy
EmptyStategroup