Shortcut component is used to display keyboard shortcuts, and it can be customized with a custom display and aria label if needed.
Import
import { Shortcut } from '@wordpress/components';
Props
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
className | string | Classname to apply to the shortcut. | ||
shortcut | string | { display: string; ariaLabel: string } | Shortcut configuration |
Examples
Default
const Default = ( props ) => {
return <Shortcut shortcut="Ctrl + S" { ...props } />;
};
With Aria Label
const WithAriaLabel = ( props ) => {
return <Shortcut shortcut="Ctrl + S" { ...props } />;
};