Componentsv2.189.1
Iconsv1.19.0
MCPv0.8.62
Tokensv0.34.3

KeyboardShortcut

Figma
Github
Storybook

Displays keyboard shortcuts with platform-aware formatting.

Importing

The component can be imported via:

import { KeyboardShortcut } from '@customerio/pluma-components/react';

Usage

Loading editor

Modifier Combinations

The hotkey prop accepts TanStack Hotkeys notation. Mod maps to ⌘ on macOS and Ctrl on Windows/Linux.

Loading editor

Inverted

Use the isInverted prop for a dark variant, suitable for inverted or dark-mode contexts.

Loading editor

Font Size Scaling

The component extends Text and uses the product-code text style. It scales to match the surrounding font size, so it works inline with headings and body text alike.

Loading editor

Inline Usage

The component renders as a <kbd> element and can be placed inline with text.

Loading editor

Platform Override

Use the platform prop to force a specific platform's display, regardless of the user's OS.

Loading editor

API

The hotkey string to display (e.g., "Mod+S", "Mod+Shift+Z", "Control+Alt+D"). Uses TanStack Hotkeys notation where "Mod" maps to ⌘ on macOS and Ctrl on Windows/Linux.

Type-safe: provides autocomplete for all valid key combinations including single keys, modifier+key combos, and multi-modifier combos.

Whether to render the inverted (dark) variant.

Override automatic platform detection. By default, the component detects the user's OS and formats accordingly.