Use this component when you want to provide users the ability to perform specific actions, like saving data.
import {render, Button} from '@shopify/ui-extensions-react/admin';
render('Playground', () => <App />);
function App() {
return (
<Button
onPress={() => {
console.log('onPress event');
}}
>
Click here
</Button>
);
}
import {extend, Button} from '@shopify/ui-extensions/admin';
extend('Playground', (root) => {
const button = root.createComponent(
Button,
{onPress: () => console.log('onPress event')},
'Click here',
);
root.appendChild(button);
});
ButtonBaseProps | ButtonAnchorProps
Sets the semantic meaning of the component’s content. When set, the role will be used by assistive technologies to help users navigate the page.
A unique identifier for the button.
Disables the button, disallowing any interaction.
Changes the visual appearance of the Button.
Sets the color treatment of the Button.
Indicate the text language. Useful when the text is in a different language than the rest of the page. It will allow assistive technologies such as screen readers to invoke the correct pronunciation. [Reference of values](https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry) ("subtag" label)
Alias for `language`
Callback when a link is pressed. If `href` is set, it will execute the callback and then navigate to the location specified by `href`.
Alias for `onClick` Callback when a button is pressed. If `href` is set, it will execute the callback and then navigate to the location specified by `href`.
Callback when focus is removed.
Callback when input is focused.
'main' | 'header' | 'footer' | 'section' | 'aside' | 'navigation' | 'ordered-list' | 'list-item' | 'list-item-separator' | 'unordered-list' | 'separator' | 'status' | 'alert' | 'generic'
The URL to link to. If set, it will navigate to the location specified by `href` after executing the `onClick` callback.
Alias for `href` If set, it will navigate to the location specified by `to` after executing the `onClick` callback.
Tells browsers to download the linked resource instead of navigating to it. Optionally accepts filename value to rename file.
Specifies where to display the linked URL
Callback when a link is pressed. If `href` is set, it will execute the callback and then navigate to the location specified by `href`.
Alias for `onClick` Callback when a link is pressed. If `href` is set, it will execute the callback and then navigate to the location specified by `href`.
A unique identifier for the button.
Disables the button, disallowing any interaction.
Changes the visual appearance of the Button.
Sets the color treatment of the Button.
Indicate the text language. Useful when the text is in a different language than the rest of the page. It will allow assistive technologies such as screen readers to invoke the correct pronunciation. [Reference of values](https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry) ("subtag" label)
Alias for `language`
Callback when focus is removed.
Callback when input is focused.