Number field
Enter a bounded number with clear increment controls.
Record key combinations into key caps, with conflict warnings, Kbd, and a searchable cheatsheet.
npx shadcn@latest add @silicon-ui/shortcut-recordernpx shadcn@latest add @silicon-ui/shortcut-recorderInstall the dependencies.
npm install lucide-react motionCopy these files into your project. Shared files are skipped if you already have them.
components/silicon-ui/shortcut-recorder/shortcut-recorder.tsxcomponents/silicon-ui/shortcut-recorder/shortcut-recorder.module.cssInstall the foundation once per app for the design and motion tokens: npx shadcn@latest add @silicon-ui/silicon-foundation
ShortcutRecorder| Prop | Type | Default |
|---|---|---|
label* | string | — |
hideLabel | boolean | false |
value | string | null | — |
defaultValue | string | null | null |
onValueChange`replaced` is the binding the new shortcut was taken from after "Use anyway", so the caller can unbind it. | (value: string | null, details: { replaced?: ShortcutBinding }) => void | — |
resetValueWhat the reset button restores. Defaults to `defaultValue`. | string | null | — |
bindingsShortcuts already in use. Recording one of them asks before taking it. | ShortcutBinding[] | [] |
warnReservedAlso warn about combinations the browser or system keeps, such as ⌘W and ⌘C. On by default. | boolean | true |
requireModifierRequire ⌘, Ctrl, or ⌥ (function keys are always allowed). On by default. | boolean | true |
platform | Platform
| — |
placeholder | string | "Record shortcut" |
description | string | — |
disabled | boolean | false |
id | string | — |
className | string | — |
ShortcutKeys| Prop | Type | Default |
|---|---|---|
shortcut* | string | — |
platform | Platform
| — |
pressedHeld key ids from `usePressedKeys`; matching caps light up. | ReadonlySet<string> | — |
size | "sm" | "md" | "md" |
className | string | — |
ShortcutList| Prop | Type | Default |
|---|---|---|
groups* | ShortcutListGroup[] | — |
labelAccessible name of the list. | string | "Keyboard shortcuts" |
searchable | boolean | true |
searchPlaceholder | string | "Search shortcuts" |
highlightPressedLight up caps as keys are held, and fade rows that do not use the held modifiers. On by default. | boolean | true |
platform | Platform
| — |
className | string | — |
ShortcutKbd| Prop | Type | Default |
|---|---|---|
children* | ReactNode | — |
pressedDraws the key pushed down and lit, such as while it is held. | boolean | false |
size | "sm" | "md" | "md" |
Also accepts the props of HTMLAttributes<HTMLElement>.
Kbd| Prop | Type | Default |
|---|---|---|
children* | ReactNode | — |
pressedDraws the key pushed down and lit, such as while it is held. | boolean | — |
size | "sm" | "md" | — |
Also accepts the props of HTMLAttributes.