Kbd
Represents a key or a keyboard combination. It renders as a <kbd> with the system’s styling.
Helpers · TaishoDS Core, in plain HTML.
Examples
One working example per case. Each example is the HTML of its preview—copy it as is, and with Core’s CSS and JS loaded, it looks and works the same.
Keyboard shortcuts inside a sentence
Open search with ⌘ K, and close it with Esc.
When to use
- You’re documenting a shortcut, like
⌘K,Esc, orCtrl + B. - You’re telling the user which key to press, in the interface or in the docs.
When not to use
- It’s code, not a key →
inline-code.
Do
- One key per
<kbd>, and build combinations from several. - Use each key’s real name on each platform.
Don’t
- Don’t use it as a decorative badge. It means “press this.”
Related
TaishoDS Core
Doesn’t need JavaScript—it’s markup and CSS.
Purely presentational.
From the CDN, without a build, load taisho.kbd.css along with taisho.base.css. That file is all you need.
For how Core works in general, see Behavior.
Accessibility
- Renders
<kbd>, the semantics for a key or key combination.
Verification
What was actually tested. Anything that wasn’t tested says so—we’d rather say “not verified” than claim too much.
- axe WCAG 2.2 A + AA in a real browser, in light and dark mode, before every release.
- keyboard Adds no keys of its own—it uses the browser’s native behavior.
- screen reader Not verified with a screen reader. Test it in your own combination of components, not just here, where each one appears alone and on its happy path.