Playground

Kbd

Show a keyboard key or shortcut.

  • Built on native elements
  • Native kbd element, announced as text.
  • Styles in one file: 05-marks.css

Import

import '@monoline/css';
import {Kbd} from '@monoline/react';

Not installed yet? Pick a route.

Copies the source and its styles into your project.

npx monoline add kbd

Usage

import {Kbd} from '@monoline/react';

<p>Press <Kbd>⌘</Kbd> <Kbd>K</Kbd> to search.</p>

Examples

Shortcut

Data Attributes

State is exposed through attributes. Style it with these selectors, not with class toggles.

This component sets no state attributes.

CSS classes

ClassStylesheet
.badge05-marks.css
.badge-accent05-marks.css
.badge-solid05-marks.css
.check05-marks.css
.check-fail05-marks.css
.check-pass05-marks.css
.dot05-marks.css
.heat-005-marks.css
.heat-105-marks.css
.heat-205-marks.css
.heat-305-marks.css
.heat-405-marks.css
.kbd05-marks.css
.key-hints05-marks.css
.swatch05-marks.css

Customization

Style it with the kit's tokens in your own CSS, loaded after @monoline/css. Prefer the attributes above over extra classes. See Theming for every token.

app.css
.badge {
  border-color: var(--accent);
}

Accessibility

  • Native kbd element, announced as text.