---
title: Button
description: "`Button` is an interactive component that allows users to perform actions such as submitting forms and toggling modals."
links:
- style: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/button/button.style.ts
- source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/button
- storybook: https://yamada-ui.github.io/yamada-ui?path=/story/components-button--basic
---
# Button
`Button` is an interactive component that allows users to perform actions such as submitting forms and toggling modals.
```tsx
```
## Usage
```tsx
import { Button, ButtonGroup } from "@yamada-ui/react"
```
```tsx
import { Button, ButtonGroup } from "@/components/ui"
```
```tsx
import { Button, ButtonGroup } from "@workspaces/ui"
```
```tsx
```
```tsx
```
:::tip
To make it function as a link, set `as="a"`. If your framework provides a link component, set `as={FrameworkLink}`. For integration with each framework's link component, see the documentation for your framework [here](https://yamada-ui.com/docs/get-started.md#pick-your-framework).
:::
:::tip
If the only child of `Button` is an icon, use [IconButton](https://yamada-ui.com/docs/components/icon-button.md).
:::
:::tip
If there are multiple `Button` components that can be grouped together, use [ButtonGroup](#grouping).
:::
### Change Variant
```tsx
{(variant, index) => (
)}
```
### Change Size
```tsx
{(size, index) => (
)}
```
### Change Color Scheme
```tsx
{(colorScheme, index) => (
)}
```
### Change Shape
To rounded corners, set `fullRounded` to `true`.
```tsx
{(variant, index) => (
)}
```
### Disable
To disable, set `disabled` to `true`.
```tsx
{(variant, index) => (
)}
```
### Add Icon
To add an icon, set a `ReactNode` to `startIcon` or `endIcon`.
```tsx
}>
Button
}>
Button
}>
Button
}>
Button
}>
Button
```
### Use Loading Animation
To use a loading animation, set `loading` to `true`. If you want to change the text during loading, use `loadingMessage`.
```tsx
}>
Button
```
:::note
The loading for `Button` internally uses [Loading](https://yamada-ui.com/docs/components/loading.md).
:::
### Grouping
```tsx
Button} />
ButtonButtonButtonButtonButtonButtonButtonButtonButtonButtonButtonButton
```
## Props
### Button
| Prop | Default | Type | Description |
| ------------------ | ---------- | ------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- |
| `as` | - | `As` | The HTML element to render. |
| `asChild` | - | `boolean` | Merges its props onto its immediate child. |
| `css` | - | `CSSObject \| CSSObject[]` | The CSS object. |
| `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. |
| `size` | `"md"` | `"2xl" \| "lg" \| "md" \| "sm" \| "xl" \| "xs"` | The size of the component. |
| `variant` | `"solid"` | `"ghost" \| "outline" \| "solid" \| "subtle" \| "surface" ...` | The variant of the component. |
| `active` | `false` | `boolean` | If `true`, the button is represented as active. |
| `disabled` | `false` | `boolean` | If `true`, the button is disabled. |
| `disableRipple` | `false` | `boolean` | If `true`, disable ripple effects when pressing a element. |
| `endIcon` | - | `ReactNode` | The icon to display at the end side of the button. |
| `iconProps` | - | `ButtonIconProps` | The props of the icon element. |
| `loading` | `false` | `boolean` | If `true`, the loading state of the button is represented. |
| `loadingIcon` | `"oval"` | `Loading.Scheme \| ReactNode` | The icon to display when the button is loading. |
| `loadingMessage` | - | `ReactNode` | The message to display when the button is loading. |
| `loadingPlacement` | `"start"` | `"end" \| "start"` | The placement of the loading indicator. Accepts `start` or `end`. |
| `loadingProps` | - | `ButtonLoadingProps` | The props of the loading icon element. |
| `startIcon` | - | `ReactNode` | The icon to display at the start side of the button. |
| `type` | `"button"` | `HTMLProps<"button">["type"]` | The type of button. Accepts `button`, `reset`, or `submit`. |
### ButtonGroup.Root
| Prop | Default | Type | Description |
| ------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------- |
| `as` | - | `As` | The HTML element to render. |
| `asChild` | - | `boolean` | Merges its props onto its immediate child. |
| `css` | - | `CSSObject \| CSSObject[]` | The CSS object. |
| `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. |
| `size` | `"md"` | `"2xl" \| "lg" \| "md" \| "sm" \| "xl" \| "xs"` | The size of the component. |
| `variant` | `"solid"` | `"ghost" \| "outline" \| "solid" \| "subtle" \| "surface" ...` | The variant of the component. |
| `align` | - | `"-moz-initial" \| "anchor-center" \| "baseline" \| "center" \| "end" \| "flex-end" \| "flex-start" \| "inherit" \| "initial" \| "normal" ...` | The CSS `align-items` property. |
| `basis` | - | `"-moz-fit-content" \| "-moz-initial" \| "-moz-max-content" \| "-moz-min-content" \| "-webkit-auto" \| "0.5" \| "1.5" \| "1" \| "1/12" \| "1/2" ...` | The CSS `flex-basis` property. |
| `direction` | - | `"-moz-initial" \| "column-reverse" \| "column" \| "inherit" \| "initial" \| "revert-layer" \| "revert" \| "row-reverse" \| "row" \| "unset" ...` | The CSS `flex-direction` property. |
| `disabled` | `false` | `boolean` | If `true`, all wrapped button will be disabled. |
| `justify` | - | `"-moz-initial" \| "center" \| "end" \| "flex-end" \| "flex-start" \| "inherit" \| "initial" \| "left" \| "normal" \| "revert-layer" ...` | The CSS `justify-content` property. |
| `shrink` | - | `"-moz-initial" \| "inherit" \| "initial" \| "revert-layer" \| "revert" \| "unset" \| AnyString \| number & {} ...` | The CSS `flex-shrink` property. |
| `wrap` | - | `"-moz-initial" \| "inherit" \| "initial" \| "nowrap" \| "revert-layer" \| "revert" \| "unset" \| "wrap-reverse" \| "wrap" \| AnyString ...` | The CSS `flex-wrap` property. |
### ButtonGroup.Item
| Prop | Default | Type | Description |
| ------------------ | ---------- | ------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- |
| `as` | - | `As` | The HTML element to render. |
| `asChild` | - | `boolean` | Merges its props onto its immediate child. |
| `css` | - | `CSSObject \| CSSObject[]` | The CSS object. |
| `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. |
| `size` | `"md"` | `"2xl" \| "lg" \| "md" \| "sm" \| "xl" \| "xs"` | The size of the component. |
| `variant` | `"solid"` | `"ghost" \| "outline" \| "solid" \| "subtle" \| "surface" ...` | The variant of the component. |
| `active` | `false` | `boolean` | If `true`, the button is represented as active. |
| `disabled` | `false` | `boolean` | If `true`, the button is disabled. |
| `disableRipple` | `false` | `boolean` | If `true`, disable ripple effects when pressing a element. |
| `endIcon` | - | `ReactNode` | The icon to display at the end side of the button. |
| `iconProps` | - | `ButtonIconProps` | The props of the icon element. |
| `loading` | `false` | `boolean` | If `true`, the loading state of the button is represented. |
| `loadingIcon` | `"oval"` | `Loading.Scheme \| ReactNode` | The icon to display when the button is loading. |
| `loadingMessage` | - | `ReactNode` | The message to display when the button is loading. |
| `loadingPlacement` | `"start"` | `"end" \| "start"` | The placement of the loading indicator. Accepts `start` or `end`. |
| `loadingProps` | - | `ButtonLoadingProps` | The props of the loading icon element. |
| `startIcon` | - | `ReactNode` | The icon to display at the start side of the button. |
| `type` | `"button"` | `HTMLProps<"button">["type"]` | The type of button. Accepts `button`, `reset`, or `submit`. |
## Accessibility
The `Button` follows the [WAI-ARIA - Button Pattern](https://www.w3.org/WAI/ARIA/apg/patterns/button/) for accessibility.
### Keyboard Navigation
| Key | Description | State |
| ---------------- | ------------------------------------- | ----- |
| `Enter`, `Space` | When element has focus, activates it. | - |
### ARIA Roles and Attributes
| Component and Element | Roles and Attributes | Usage |
| --------------------- | -------------------- | ----------------------------------------------------------------------------------------------- |
| `button.ui-button` | `role="button"` | By default, `Button` renders as `button.ui-button`. The host element changes when `as` is used. |
## Similar Components
- [CloseButton](https://yamada-ui.com/docs/components/close-button.md): `CloseButton` is a component used primarily to trigger the close functionality of a component.
- [IconButton](https://yamada-ui.com/docs/components/icon-button.md): `IconButton` is a component that displays an icon within a button.
- [FileButton](https://yamada-ui.com/docs/components/file-button.md): `FileButton` is a button component used for users to select files.
- [Toggle](https://yamada-ui.com/docs/components/toggle.md): `Toggle` is a component that has two states: on or off.
## Uses Components & Hooks
- [Group](https://yamada-ui.com/docs/components/group.md): `Group` is a component that groups and attaches multiple elements together.
- [Loading](https://yamada-ui.com/docs/components/loading.md): `Loading` is a component displayed during waiting times, such as when data is being loaded.
- [Ripple](https://yamada-ui.com/docs/components/ripple.md): `Ripple` is a component that adds a ripple effect to elements, allowing users to recognize when they have clicked.
## Used By Components & Hooks
- [ActionBar](https://yamada-ui.com/docs/components/action-bar.md): `ActionBar` is a component that is used to display a bottom action bar with a set of actions.
- [Calendar](https://yamada-ui.com/docs/components/calendar.md): `Calendar` is a component for displaying or selecting dates in a calendar.
- [Carousel](https://yamada-ui.com/docs/components/carousel.md): `Carousel` is a component that displays multiple elements like a slideshow.
- [CloseButton](https://yamada-ui.com/docs/components/close-button.md): `CloseButton` is a component used primarily to trigger the close functionality of a component.
- [Drawer](https://yamada-ui.com/docs/components/drawer.md): `Drawer` is a component for a panel that appears from the edge of the screen.
- [FileButton](https://yamada-ui.com/docs/components/file-button.md): `FileButton` is a button component used for users to select files.
- [Form](https://yamada-ui.com/docs/components/form.md): `Form` is a component used to group multiple form elements.
- [Menu](https://yamada-ui.com/docs/components/menu.md): `Menu` is a component that displays a common dropdown menu.
- [Modal](https://yamada-ui.com/docs/components/modal.md): `Modal` is a component that is displayed over the main content to focus the user's attention solely on the information.
- [NativePopover](https://yamada-ui.com/docs/components/native-popover.md): `NativePopover` is a component that floats around an element to display information using the HTML Popover API.
- [NumberInput](https://yamada-ui.com/docs/components/number-input.md): `NumberInput` is a component used to obtain numeric input from the user.
- [Pagination](https://yamada-ui.com/docs/components/pagination.md): `Pagination` is a component for managing the pagination and navigation of content.
- [PasswordInput](https://yamada-ui.com/docs/components/password-input.md): `PasswordInput` is a component that allows users to input passwords with a visibility toggle.
- [Popover](https://yamada-ui.com/docs/components/popover.md): `Popover` is a component that floats around an element to display information.
- [Portal](https://yamada-ui.com/docs/components/portal.md): `Portal` is a component that renders elements outside of the current `DOM` hierarchy.
- [Tip](https://yamada-ui.com/docs/components/tip.md): `Tip` is a component that displays supplementary information with a built-in icon trigger.
- [Toggle](https://yamada-ui.com/docs/components/toggle.md): `Toggle` is a component that has two states: on or off.