import SEO from '../components/SEO' # Button
The Button component is used to trigger an action or event, such as submitting a form, opening a dialog, canceling an action, or performing a delete operation.
See `CButton`'s accessibility report ### Import ```js import { CButton } from "chakra-ui/vue" ``` ### Usage ```vue live=true Button ``` ### Button Sizes Use the `size` prop to change the size of the `CButton`. You can set the value to `xs`, `sm`, `md` or `lg`. ```vue live=true Button Button Button Button ``` ### Button Variant Use the `variant` prop to change the visual style of the `CButton`. You can set the value to `solid`, `ghost`, `outline`, or `link`. ```vue live=true Button Button Button Button ``` ### Button with Icon You can add left and right icons to the Button component. See how to [add icons](#/icon) to your project. ```vue live=true Email Call us ``` ### Button loading state Pass `isLoading` prop to the Button component to show it's loading state. You can optionally pass `loadingText` prop, if you do, the button will show a spinner and the loading text. Otherwise, the button will take the width of the text label and show only the spinner. ```vue live=true Email Submit ``` ### Accessibility - `CButton` has `role` button. - When `CButton` has focus, `space` and `enter` activates it. ### Composition `CButton` composes [`CPseudobox`](#) and all props (variant, variantColor, etc.) are converted to style props. This means you can override any style of the `CButton` via props. ```vue live=true // The size prop affects the height of the button // but I can still override it by passing a custom height Button ``` ### Custom Button In event you need to make your own custom button, you can leverage the `PseudoBox` component. It provides the `hover`, `focus`, `active` and `disabled` style props to style the button. ```vue live=true Join Group ``` ## Props The Button composes the `CPseudoBox` component so you can pass props for `CPseudoBox`. These are props related to the Button component. | Name | Type | Default | Description | | --------------------- | ------------------------------------------------| --------| ------------------------------------------------------------------------------------------------------- | | `aria-label` | `string` | | The label of the button | | `variant ` | `string` | | The color of the button. Use a color key passed in `theme.colors`. | | `variantColor` | `outline`, `ghost`, `unstyled` , `link` , `solid` | `solid` | The color of the button. Use a color key passed in `theme.colors`. | | `isDisabled` | `boolean` | | If `true`, the button will be disabled. | | `isLoading` | `boolean` | | If `true`, the button will show a spinner | | `loadingText` | `string` | | The label to show in the button when isLoading is true. If no text is passed, it only shows the spinner | | `size` | `xs`, `sm`,`md`, `lg` | `md` | The size of the button |