Skip to content
Cynosurev0.5.0
SearchStorybookGitHubnpmColour mode: System. Switch to Light

Components / Feedback and display

Kbd

A keyboard shortcut shown as drawn key caps. Screen readers get a spoken combination instead ("Control plus K").

Reads as akey combination

UsageLink to "Usage"

tsx
Copy
import { Kbd } from "@arshad-shah/cynosure";

<Kbd keys={["Ctrl", "K"]} />
<Kbd keys={["Cmd", "Shift", "P"]} size="sm" />
<Kbd keys={["⌘", "K"]} label="Command K" />

keys lists the keys in order. Keys are joined by a drawn separator, not a "+" character. size is sm, md (default) or lg.

Spoken textLink to "Spoken text"

Common names are spoken in full: Ctrl as Control, Cmd as Command, Esc as Escape, and so on. For symbols or unusual keys, set label to say what you mean.

Speaks symbol names

PropsLink to "Props"

Every prop of Kbd
PropWhat it doesTypeDefault
keysRequired
Keys in order, e.g. ["Ctrl", "K"]; or a shortcut as useHotkey writes it ("mod+k"), shown with this platform's names (Cmd on Apple, Ctrl elsewhere) and hidden on touch-only screens, where a shortcut means nothing.string | string[]
size
Size of the key caps. Default "md".Size"md"
label
Override the spoken text (default "Control plus K").string
className
Added to the root element, for layout.string
style
Layout only.CSSProperties

Generated from the type definitions in @arshad-shah/cynosure 0.5.0.

ThemingLink to "Theming"

Tokens: --cy-kbd-radius, --cy-kbd-bg and --cy-kbd-border.

ts
Copy
createTheme({ components: { kbd: { radius: "6px" } } });

Button · Tooltip

These examples run Cynosure 0.5.0 (commit 50ce30b), the version on npm.

Getting started
Theming
Icons
Accessibility
Code editors and highlighters
Using Cynosure without React
Build-tool adapters
Components
Accordion
AppShell
AspectRatio
Breadcrumbs
Calendar
Card
Container
Disclosure
Divider
DocumentViewport
Grid
Inline
PageHeader
PanZoomCanvas
ScrollArea
SideNav
SortableList
SplitPane
Stack
StatusBar
Tabs
TitleBar
Toolbar
Tree
VirtualList
ZoomControls
Announcer
Avatar
Badge
CodeBlock
DescriptionList
EmptyState
ErrorBoundary
Field
Heading
IconTile
Image
Kbd
List
LoadingDots
Notice
ProgressBar
Prose
Skeleton
Stat
Steps
Table
Text
Button
Checkbox
Checklist
ColorField
ColorSwatches
Combobox
CompareSlider
CopyButton
DateField
FileDrop
IconButton
KeyValueEditor
Link
NumberField
Pagination
PathField
RadioGroup
SearchField
SegmentedControl
Select
SelectionFrame
SignaturePad
Slider
Switch
TagInput
TextArea
TextField
ThemeToggle
TimeField
ButtonBase
ChoiceBase
DialogBase
FileInputBase
HiddenValue
Icon
InputBase
LinkBase
LiveRegion
TextAreaBase
ChatMessage
Choice
DataGrid
DeviceFrame
HighlightedText
HotkeyField
ListRow
OptionList
OverlayFrame
QRCode
RowActions
Section
SiteFooter
SiteHeader
SkipLink
SortButton
VisuallyHidden
CommandPalette
ContextMenu
Dialog
FloatingToolbar
HoverCard
Menu
Menubar
Popover
ProgressOverlay
Sheet
Toast
Tooltip
Changelog