Skip to content

Button

A focusable button control. Integrates with the silvery focus system and responds to Enter or Space key to activate.

Import

tsx
import { Button } from "silvery"

Props

ButtonProps extends BoxProps (excluding children).

PropTypeDefaultDescription
labelstringrequiredButton label
onPress() => voidrequiredCalled when activated (Enter or Space)
isActivebooleanfrom focus systemWhether input is active
colorstring--Button color

All BoxProps layout and style props are also accepted.

Rendering

Renders [ label ] with inverse styling when focused. Activates on Enter or Space key press.

Usage

tsx
<Button label="Save" onPress={() => save()} />
<Button label="Cancel" onPress={() => close()} color="red" />

// With explicit active control (bypasses focus system)
<Button label="OK" onPress={confirm} isActive={hasFocus} />

See Also

  • Toggle -- focusable checkbox-style toggle
  • Form -- form layout with fields

Released under the MIT License.