Skip to content

ShortcutHint

Show how to hold keys together to perform a keyboard shortcut.

Press Command + K to open search.

Preview settings

2
112px
2400ms
Iterations
React
import { ShortcutHint } from "@gestik/react";

<ShortcutHint
  keys={["Command","K"]}
  size={112}
  duration={2400}
  iterations="infinite"
  playing={true}
/>

Props

PropDefaultPurpose
keys["Command", "K"]At least two labels or decorative React elements, in press order. No maximum.
sizeFits the keys (112 by default)Scene width in pixels; the entire row scales proportionally.
duration2400One press, hold, release, and rest cycle in milliseconds.
iterations"infinite"Total number of complete cycles, or infinite.
playingtruePause or resume at the current frame.
className—A class for styling the hint.
style—Inline styles and --gestik-* CSS variables on the outer span.

Example

Press Command + Option + K to open the command menu. Custom symbols share the mint keycaps with a text legend.

import { ShortcutHint } from "@gestik/react";
import { CommandIcon, OptionIcon } from "@phosphor-icons/react";

<ShortcutHint
  className="custom-shortcut-hint"
  keys={[
    <CommandIcon key="command" weight="bold" />,
    <OptionIcon key="option" weight="bold" />,
    "K",
  ]}
/>

Accessibility

ShortcutHint is decorative, stays out of the tab order, and ignores pointer events. Pair it with visible instructions such as “Press Command + K to open search” and an accessible control for the same action. Under reduced motion, every key remains still and released. Your application implements the shortcut and decides when the hint appears. This docs example does not register a keyboard shortcut.