Skip to content
Work in progress. These docs describe Spawnite at launch, and some parts are still being built.

Button

Button(props): Element

The ui’s Button, with a row in the devtools tree under the Panel or Hud it stands in, named by its text: Button: Play.

Parameter Type Description
props { children: ReactNode; className?: string; classNames?: ButtonClassNames; disabled?: boolean; keyShortcuts?: string; label?: string; onPress: () => void; pressed?: boolean; style?: CSSProperties; variant?: ButtonVariant; } -
props.children ReactNode One icon, or a word or two.
props.className? string An override that shows in the diff.
props.classNames? ButtonClassNames An override per part, over className for the root.
props.disabled? boolean Off: dimmed, no press lands, and Tab passes it, as a browser’s own disabled button.
props.keyShortcuts? string The key that presses it too, which the caller binds, written as aria-keyshortcuts writes one, such as "R" or "Shift+E". A screen reader announces it, and the engine’s development warning knows a player reaches the button while the cursor is captured.
props.label? string The accessible name, which a button of text takes from its text and a button of one icon needs spelled out.
props.onPress () => void The press. The component does not know what the state becomes: the caller owns it, and pressed is how it comes back.
props.pressed? boolean A toggle’s state; off dims the button. Left out by a button that holds none: a press that jumps the sun is over when it lands, so there is nothing to report.
props.style? CSSProperties A style that comes from data, such as an item’s rarity colour or a place on a grid. A look that is the same every time is a class.
props.variant? ButtonVariant The look.

Element