Kbd
Keyboard key label for shortcuts and command hints, with the semantics of the native kbd element.
Slots
| Name | Description |
|---|---|
(default) | Key name or shortcut to display. |
CSS parts
Shadow DOM styling hooks used with ::part(name). Prefer CSS custom properties when they cover the change.
| Name | Description |
|---|---|
kbd | The native <kbd> element containing the key or shortcut. |
CSS custom properties
Grouped by semantic target and state from --c2-<component>__<target>__<state>--<property>. Click a group to collapse it; click a name to copy it.
| Name | Type | Default | Description |
|---|---|---|---|
--c2-kbd--min-width | pixel | 24px | |
--c2-kbd--height | pixel | 24px | |
--c2-kbd--padding-left | padding | 6px | |
--c2-kbd--padding-right | padding | 6px | |
--c2-kbd--gap | pixel | 4px | Space between multiple slotted nodes. |
--c2-kbd--background-color | color | #fafafa | |
--c2-kbd--color | color | #71717a | |
--c2-kbd--border | border | 1px solid #e4e4e7 | |
--c2-kbd--border-radius | border-radius | 5px | |
--c2-kbd--box-shadow | box-shadow | none | Flat by default; 0 1px 0 #a1a1aa gives the key a raised edge. |
--c2-kbd--font-family | font-family | ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace | |
--c2-kbd--font-size | font-size | 12px | |
--c2-kbd--font-weight | font-weight | 500 | |
--c2-kbd--line-height | line-height | 1 | |
--c2-kbd--letter-spacing | pixel | 0.01em | |
--c2-kbd--text-transform | text-transform | none | |