Skip to main content
ComponentsActions

Component · Actions

Button

Activation primitive. Enter/Space or pointer activate once; disabled/loading never activate.

Kind
widget
Input
interactive
Canvas
120×40

Live preview

Loading terminal preview.

Static terminal poster. Choose Run live to start the Rust demo.

Ghosttybutton/activation
Loading terminal poster…
○ loading posterNo input — rendered state only
Button · exact mounted Rust story

01 · Purpose

What it is for

Activation primitive. Enter/Space or pointer activate once; disabled/loading never activate.

Best fit: Actions · action · widget

02 · Behavior

What the mounted story proves

  1. 01

    Button

    Representative 120×40 terminal state.

  2. 02

    Passive paint

    No keyboard or pointer action is claimed by this representative story.

  3. 03

    Evidence stays explicit

    3 covered · 8 partial · 5 missing axes.

03 · Implement

Install, then start from exact code

Install

cargo add termrock --git https://github.com/tailrocks/termrock.git --rev 5283c2acf9154d0cfcd37b1ffe821c00faf90ea2

Add TermRock once. Keep domain effects in the host application.

Minimal implementation

Exact Rust setup used by button/activation.

Open to load code.

04 · Adapt

Variants and composition

Variants

Use the preview Variant menu when alternate registered stories exist. Each selection mounts a fresh configuration.

Composition

Actions · action · widget

05 · Reference

API, tokens, accessibility

Tokens

DesignSystemInspect exact story code for roles and capability projection.

Accessibility

Input contract mountedNo input claim in the representative story.

Contract

Evidence in progress3/23 axes covered

06 · Go deeper

Advanced guidance

Authored implementation guidance

Purpose. Domain-neutral control that signals one activation. Effects stay consumer-owned (ActivationOutcome). Multi-id toolbars still use ActionBar.

When to use / when not

Use ButtonPrefer
One labeled or icon action—
Dialog / form footer CTA—
Several stable-ID actionsActionBar / Action
NavigationTabs / List

Focus law

ConcernOwner
Surface inputActivationState::set_accepts_input (host/scene)
Pressed / armedActivationState (pointer Down / Space)
Default dialog focusHost — never default-focus Destructive (is_safe_default_focus)

Variants

Primary · Secondary · Quiet · Outline · Destructive · Link · Success · Command

Sizes

Compact · Normal (pad only; always 1 row).

Activation

  • default_button_intent → Enter/Space map to UiIntent::Activate
  • Enter: activate on Press (once; Repeat ignored)
  • Space: arm on Press, activate on Release
  • Pointer: Down arms, Up inside hit activates; drag-off cancels
  • Loading and disabled never activate (distinct paint)
  • set_pending_confirmation(true) → first Activate is ConfirmRequired

Non-color

  • Colorless: strong text for primary/danger/success; outline uses [ ]
  • Loading: … / ... prefix (not same as disabled dim alone)
  • Icon-only without a11y name paints danger mark (refuse silent control)

Responsive

WidthBehavior
full_widthFill area
narrow (< 12)Drop trailing then leading glyphs
tiny (< 6)Label start only
Ownership boundary

TermRock owns reusable terminal rendering and interaction state. The host owns domain data, policy, persistence, authorization, and side effects.

Evidence status

3 covered, 8 partial, and 5 missing contract axes. Missing evidence is not a behavior claim.