Button
Buttons allow users to perform an action or to navigate to another page. They have multiple styles for various needs, and are ideal for calling attention to where a user needs to do something in order to move forward in a flow.
Variants
Primary Button
Primary buttons should be used sparingly, one per screen, as they are used to guide the user towards taking a primary action.
Create user
<Button variant="primary">Create user</Button>Secondary Button
Secondary buttons add less emphasis and often accompany primary buttons in button groups, like the side panel footer.
Sync profile
<Button variant="secondary">Sync profile</Button>Tertiary Button
Tertiary buttons are used for actions requiring less emphasis.
Cancel
<Button variant="tertiary">Cancel</Button>Critical Button
Crtical buttons are used for actions that require the most emphasis, as they are used to guide the user towards taking a destructive or potentially dangerous action.
Delete user
<Button variant="critical">Delete user</Button>Props
Changes the appearance of the button.
Whether the button is in a pending state. This disables press and hover events while retaining focusability, and announces the pending state to screen readers.
Whether the button is disabled.
Handler that is called when the press is released over the target.
Handler that is called when a press interaction starts.
Handler that is called when a press interaction ends, either over the target or when the pointer leaves the target.
Handler that is called when the press state changes.
Handler that is called when a press is released over the target, regardless of whether it started on the target or not.
Not recommended – use onPress instead. onClick is an alias for onPress
provided for compatibility with other libraries. onPress provides
additional event details for non-mouse interactions.
Whether the element should receive focus on render.
Handler that is called when the element receives focus.
Handler that is called when the element loses focus.
Handler that is called when the element's focus status changes.
Handler that is called when a key is pressed.
Handler that is called when a key is released.
The behavior of the button when used in an HTML form.
Whether to prevent focus from moving to the button when pressing it.
Caution, this can make the button inaccessible and should only be used when alternative keyboard interaction is provided, such as ComboBox's MenuTrigger or a NumberField's increment/decrement control.
The <form> element to associate the button with.
The value of this attribute must be the id of a <form> in the same document.
See MDN.
The URL that processes the information submitted by the button. Overrides the action attribute of the button's form owner.
Indicates how to encode the form data that is submitted.
Indicates the HTTP method used to submit the form.
Indicates that the form is not to be validated when it is submitted.
Overrides the target attribute of the button's form owner.
Submitted as a pair with the button's value as part of the form data.
The value associated with the button's name when it's submitted with the form data.
Whether to exclude the element from the sequential tab order. If true, the element will not be focusable via the keyboard by tabbing. This should be avoided except in rare scenarios where an alternative means of accessing the element or its functionality via the keyboard is available.
The element's unique identifier. See MDN.
Handler that is called when a hover interaction starts.
Handler that is called when a hover interaction ends.
Handler that is called when the hover state changes.
A slot name for the component. Slots allow the component to receive props from a parent component.
An explicit null value indicates that the local props completely override all props received from a parent.
The children of the component. A function may be provided to alter the children based on component state.
The CSS className for the element. A function may be provided to compute the class based on component state.
The inline style for the element. A function may be provided to compute the style based on component state.