sdxc

Type to search, or start from one of these:

[ @sdxc/ui ]

ShortcutList

The list a keyboard-shortcuts panel shows.

Installation

An ordinary dependency: install it, import the theme once, and import the component where it is used.

npm add @sdxc/ui
import "@sdxc/ui/theme.css";

Usage

import { ShortcutList } from "@sdxc/ui";

Renders the list's host <dl>, a two-column grid whose first column takes the actions and whose second sizes itself to the widest run of caps.

Composition

The parts the component publishes, each a static property of the host.

  • ShortcutList
  • ShortcutList.ItemRenders one binding as a <dt> naming the action and a <dd> holding a cap per key.

Examples

<ShortcutList>
	<ShortcutList.Item keys={keyComboGlyphs("mod+k", apple)}>{t("openSearch")}</ShortcutList.Item>
	<ShortcutList.Item keys={["?"]}>{t("showShortcuts")}</ShortcutList.Item>
</ShortcutList>

Props

Read from the component's own types, so every prop, every default and every allowed value is listed.

PropTypeDescription
childrenRemixNodeOne ShortcutList.Item per binding, in the order the panel lists them.

Also accepts everything in TagProps<"dl">.

ShortcutList.Item

PropTypeDescription
keysstring[]The caps to press, in press order, each already the glyph to print — a combo formatted for the reader's keyboard by keyComboGlyphs(), or a bare character.
childrenRemixNodeWhat pressing the keys does.

Also accepts everything in TagProps<"div">.

Written by Sergio Xalambrí. Follow @sergiodxa for new packages, or sponsor the work.