Kbd
Show a shortcut in running text.
Examples
Show a shortcut in running text
Press Shift + Enter to insert a new line.
React code
import { Kbd } from "@accelerate/react/components";
export function Example() {
return (
<>
<p>Press <Kbd>Shift</Kbd> + <Kbd>Enter</Kbd> to insert a new line.</p>
</>
);
}Angular code
import { Component } from "@angular/core";
import { AccKbd } from "@accelerate/angular/components";
@Component({
selector: "app-example",
imports: [
AccKbd,
],
template: `
<p>Press <kbd accKbd>Shift</kbd> + <kbd accKbd>Enter</kbd> to insert a new line.</p>
`,
})
export class Example {}Installation
Source preview. The expanded component catalog is ahead of the public npm releases. To run these examples in your own application, use packages built from the SDK source used for the previews or a release that includes the APIs below.
- React
@accelerate/ui@0.4.0and@accelerate/react@0.4.0- Angular
@accelerate/ui@0.4.0and@accelerate/angular@0.2.0
Load @accelerate/ui/theme.css and put acc-theme on the app or the region using Accelerator components. See the framework setup guide for the theme and adapter conventions.
Usage
Marks an input key or keyboard shortcut.
Import the React component Kbd from @accelerate/react/components. For Angular, add AccKbd to the standalone component’s imports and use <kbd accKbd>.
Examples use these React parts: Kbd. The Angular examples show the corresponding directives and template hosts.
API reference
- Content
- Use one kbd element per key.
- Shortcut behavior
- Implement keyboard bindings in the consuming application.