- Implementation
Common Examples
Button component can be used in the same way that you would use an HTML button element, while the ButtonLink component can be used in the same way that you would use an HTML a element.Form Submit
Thetype prop can be used to alter the default functionality of the button. A common use case is to use type="submit" in order to submit the content of a form.Button links
In general, Links should be used for navigating to other pages or website. To create a link that is styled like a button, use theButtonLink component.Using button compounds to make components interactive
To add interactivity to components that are usually static, such as avatars, use the
ButtonCompound component.Interactive cards
To make cards clickable, use theInteractiveCard component. It supports nested interactive elements without accessibility violations.AI Mark
Use theaiMark prop to display an AI indicator. aiMark accepts a boolean, or one of:"mark""chat""edit""form""mic""search"
aiMark prop cannot be used together with a before icon (a single icon Svg or icon={{ before: Svg }}).| Button usage | aiMark | icon allowed? |
|---|---|---|
With children | true or an AI icon name | Only after: use icon={{ after: Svg }} or omit icon. You cannot use a before icon or a single icon Svg. |
Icon-only (no children) | true or an AI icon name | No. Do not pass icon. Only the AI icon is shown. Always provide aria-label. |
Minimum width for buttons
If aButton component has any children, it will have a 5rem minimum width. This is not applied in icon-only buttons using the icon prop. In some cases, such as when adding a Badge as a child of a Button component without any text, this can lead to unexpected width changes.Either override the width and minWidth of the Button component, or make the Badge a sibling of the Button inside of a div with relative positioning.React Accessibility
Icon-only buttons
Do
Don’t