CraftUI

Main Menu

Ore UI's main menu: a big green Play button, light buttons under it, the player's character, and controls in the top corner.

Choose something.
Open on a page of its own

Installation

npx shadcn@latest add @runqora/craft-main-menu

Usage

import { MainMenu, MainMenuIconButton } from "@/components/craft/blocks/main-menu";

<MainMenu
  actions={[
    { label: "Marketplace", onClick: openMarketplace },
    { label: "Dressing room", onClick: openDressingRoom },
  ]}
  background={<img alt="" src="/world.png" />}
  character={<img alt="" src="/character.png" />}
  playerName="Skylark"
  primaryAction={{ label: "Play", onClick: play }}
  toolbar={<MainMenuIconButton aria-label="Settings" icon={<SettingsIcon />} />}
/>;

Props

Prop

Type

Prop

Type

Accessibility

  • The buttons are a navigation landmark named Main menu, with Play first.
  • The red dot on an icon button is only drawn. Say what it means in the button's name, such as "Inbox, 1 unread message".
  • The character and background are decorative.

Customization

Play uses the hero button, and the other choices the secondary one. On a narrow screen the character is left out, so the buttons have the room. Every screen fills its frame, so give it a height, such as h-dvh for a whole page.

Dependencies

  • craft-button and craft-screen
  • shadcn's utils, and craft-theme

Source