Shortcut

Shortcut component is used to display keyboard shortcuts, and it can be customized with a custom display and aria label if needed.

import { Shortcut } from '@wordpress/components';

View on Storybook

View source on GitHub

PropsPermalink to this section

NameDefaultDescription
className

string

Classname to apply to the shortcut.

shortcut

string | { display: string; ariaLabel: string; } | undefined

Shortcut configuration

ExamplesPermalink to this section

DefaultPermalink to this section

const Default = ( props ) => {
	return <Shortcut shortcut="Ctrl + S" { ...props } />;
};

With Aria LabelPermalink to this section

const WithAriaLabel = ( props ) => {
	return <Shortcut shortcut="Ctrl + S" { ...props } />;
};