Kbd
Kbd renders native keyboard-input notation with finished Brick sizing and visual recipes.
Built from the published package
Press Ctrl + Shift + P to open commands.
Know when Kbd is the right part
Use it when
Use Kbd inside meaningful copy to name one key, or repeat it for an authored key sequence.
Choose another path when
Do not use Kbd to register shortcuts, listen for keys, translate platform labels, or render ordinary technical literals. Application behavior owns shortcuts; use Code for literals.
Installation and imports
For modular CSS:
Kbd is also available from @flowstack-ui/brick.
Quick start
Visual recipes and states
Raised suggests a physical key, outline preserves a lighter boundary, subtle uses a quiet filled surface, and plain keeps only typographic notation. Sizes adjust the compact key footprint without creating a control target.
Examples
API
Start with the public parts and root options below. Components with multiple parts separate each area into its own named subsection.
| Prop | Values | Default |
|---|---|---|
variant | raised, outline, subtle, plain | raised |
size | sm, md, lg | md |
slot | string | kbd |
Public exports are Kbd, KbdProps, KbdVariant, and KbdSize.
Accessibility
Native kbd communicates keyboard input. Kbd adds no role, tab stop, or shortcut behavior. Forced colors restores a system-readable boundary for every variant.
Responsive behavior
Kbd stays inline and prevents one key label from wrapping. Sequences wrap between separately authored key hosts and separators.
Styling and tokens
Customization
Choose size and variant first, then documented variables for a deliberate local recipe.
Tokens and CSS hooks
Use .brick-kbd, data-slot, data-size, data-variant,
--brick-kbd-background, --brick-kbd-foreground,
--brick-kbd-border-color, --brick-kbd-border-block-end-color,
--brick-kbd-radius, --brick-kbd-font-family, --brick-kbd-font-size,
--brick-kbd-font-weight, --brick-kbd-line-height,
--brick-kbd-letter-spacing,
--brick-kbd-min-block-size, --brick-kbd-padding-inline, and
--brick-kbd-shadow.
Advanced reference
Open these details only when you need to inspect DOM ownership, native forwarding, or lower-level composition.