UNPKG

@wordpress/components

Version:
39 lines (21 loc) 1.51 kB
# `NavigatorButton` <div class="callout callout-alert"> This feature is still experimental. “Experimental” means this is an early implementation subject to drastic and breaking changes. </div> The `NavigatorButton` component can be used to navigate to a screen and should be used in combination with the [`NavigatorProvider`](/packages/components/src/navigator/navigator-provider/README.md), the [`NavigatorScreen`](/packages/components/src/navigator/navigator-screen/README.md) and the [`NavigatorBackButton`](/packages/components/src/navigator/navigator-back-button/README.md) components (or the `useNavigator` hook). ## Usage Refer to [the `NavigatorProvider` component](/packages/components/src/navigator/navigator-provider/README.md#usage) for a usage example. ## Props The component accepts the following props: ### `attributeName`: `string` The HTML attribute used to identify the `NavigatorButton`, which is used by `Navigator` to restore focus. - Required: No - Default: `id` ### `onClick`: `React.MouseEventHandler< HTMLElement >` The callback called in response to a `click` event. - Required: No ### `path`: `string` The path of the screen to navigate to. The value of this prop needs to be [a valid value for an HTML attribute](https://html.spec.whatwg.org/multipage/syntax.html#attributes-2). - Required: Yes ### Inherited props `NavigatorButton` also inherits all of the [`Button` props](/packages/components/src/button/README.md#props), except for `href` and `target`.