Skip to content

Button

<Button onPress> is the game’s one button: a glass surface around a word or one icon. It fires onPress on a click, so a player can press, slide off and cancel. For an action timed against the world, use Tap.

Its props are in Button.

import {
Button,
Hud,
Icon,
Panel,
Slot,
useScenes,
} from "@daniel-zarinski/engine";
export function Menu() {
const scenes = useScenes();
return (
<Hud>
<Panel slot={Slot.Bottom}>
<Button onPress={() => scenes.go("run")}>Play</Button>
<Button label="Settings" onPress={() => scenes.go("settings")}>
<Icon name="settings" className="size-7" />
</Button>
</Panel>
</Hud>
);
}