Skip to content

@jsvision/ui / item

Function: item() ​

item(title, command, key?): MenuItem

Defined in: ui/src/menu/builders.ts:226

Build a command item — a selectable row that emits command when chosen. Handle the command from the status line, the app, or a Dialog.

Parameters ​

title ​

string

The item label; ~X~ marks its accelerator character.

command ​

string

The command name emitted when the item is chosen.

key? ​

string

Optional accelerator label shown right-aligned, e.g. 'Alt+X' or 'Ctrl+S'.

Returns ​

MenuItem

A command MenuItem node.

Example ​

ts
import { item, Commands } from '@jsvision/ui';

const tile = item('~T~ile', Commands.tile, 'F4');