SearchCtrlK

  • ↑↓navigate
  • ↵open
  • escclose

Can’t find it? Contact us

ShortcutList

The list a keyboard-shortcuts panel shows.

Demo apps

Whole pages built only from @sdxc/ui, each for an invented product with its own palette and type. They open in a new tab.

Every demo, landings and docs sites alike, is listed in the showcase.

Installation

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

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

Usage

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

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: its ShortcutList.Action and ShortcutList.Keys.
  • ShortcutList.ActionWhat pressing the keys does, in the list's first column.
  • ShortcutList.KeysThe caps to press, in press order, end-aligned in the list's second column.
  • ShortcutList.KeyOne cap, already the glyph to print: a combo formatted for the reader's keyboard by keyComboGlyphs(), or a bare character.

Examples

Shortcuts panel

Open search
CtrlK
Save the draft
CtrlS
Show keyboard shortcuts
?
View code
tsx
<ShortcutList mix={[is("18rem")]}>
	<ShortcutList.Item>
		<ShortcutList.Action>Open search</ShortcutList.Action>
		<ShortcutList.Keys>
			{keyComboGlyphs("mod+k", appleKeyboard).map((key) => <ShortcutList.Key>{key}</ShortcutList.Key>)}
		</ShortcutList.Keys>
	</ShortcutList.Item>
	<ShortcutList.Item>
		<ShortcutList.Action>Save the draft</ShortcutList.Action>
		<ShortcutList.Keys>
			{keyComboGlyphs("mod+s", appleKeyboard).map((key) => <ShortcutList.Key>{key}</ShortcutList.Key>)}
		</ShortcutList.Keys>
	</ShortcutList.Item>
	<ShortcutList.Item>
		<ShortcutList.Action>Show keyboard shortcuts</ShortcutList.Action>
		<ShortcutList.Keys>
			<ShortcutList.Key>?</ShortcutList.Key>
		</ShortcutList.Keys>
	</ShortcutList.Item>
</ShortcutList>

Props

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

PropTypeDefaultRequiredDescription
childrenRemixNode—YesOne ShortcutList.Item per binding, in the order the panel lists them.

Also accepts everything in TagProps<"dl">.

ShortcutList.Item

PropTypeDefaultRequiredDescription
childrenRemixNode—YesA ShortcutList.Action and its ShortcutList.Keys.

Also accepts everything in TagProps<"div">.

ShortcutList.Action

Also accepts everything in TagProps<"dt">.

ShortcutList.Keys

Also accepts everything in TagProps<"dd">.

ShortcutList.Key

Also accepts everything in TagProps<"kbd">.

@sdxc/ui

Can’t find it? Contact us