Skip to content

Shortcut

A keyboard shortcut, written the way this person will press it: mod is ⌘ on a Mac and Ctrl elsewhere. Screen readers hear it as words.

import { Shortcut } from '@sypnia/ui/react'

On this page
  1. Shortcuts of a console
  2. Skeleton
  3. When to use it
  4. For everyone
  5. Props

Shortcuts of a console

Search
CtrlK
Run the query
Ctrl↵
Show all shortcuts
⇧?
Go to tables
GT
Code
import { Shortcut } from '@sypnia/ui/react';

// «mod» is ⌘ on a Mac and Ctrl elsewhere. Keys pressed one after the other go with «then».
export default function Keys() {
  return (
    <dl className="sy-kv">
      <dt>Search</dt><dd><Shortcut keys={['mod', 'K']} /></dd>
      <dt>Run the query</dt><dd><Shortcut keys={['mod', 'enter']} /></dd>
      <dt>Show all shortcuts</dt><dd><Shortcut keys={['shift', '?']} /></dd>
      <dt>Go to tables</dt><dd><Shortcut keys={['G', 'then', 'T']} /></dd>
    </dl>
  );
}

Skeleton

The real piece and its skeleton: the same box, so nothing moves when the data arrives.

CtrlK
Code
import { Shortcut, ShortcutSkeleton } from '@sypnia/ui/react';

// The keys and their skeleton: the same height and room.
export default function Skeleton() {
  return <div className="sy-row"><Shortcut keys={['mod', 'K']} /><ShortcutSkeleton keys={2} /></div>;
}

When to use it

Use it when

  • In menus, tooltips and help next to the action it runs.
  • Keys pressed one after the other go with then.

Do not use it when

  • Shortcuts that do not exist on phones being the only way to do something.
  • Long lists of shortcuts in the page itself: put them in a help dialog.

For everyone

  • It is read as «Press Control K», not as symbols.
  • The keys are drawn as keys, but the words carry the meaning.

Props

ShortcutTypeDefault
keysrequired string[]
  1. Shortcuts of a console
  2. Skeleton
  3. When to use it
  4. For everyone
  5. Props

    Search pages, sections and terms