JGuang

Button

Button · Arco Design

Preview
npm install @arco-design/web-react@2.66.18

Button

A button is a command component to trigger an operation.

Install

npm install @arco-design/web-react@2.66.18

Import @arco-design/web-react/dist/css/arco.css at the entry and set the locale with ConfigProvider. React 19 projects must also import @arco-design/web-react/es/_util/react-19-adapter first, or imperative APIs such as Message and Modal cannot render.

Examples

  • Basic: There are primary, secondary, dashed, outline and text button types.
  • Icon: Icons can be used in buttons. When icon is set and there are no children, the height and width of the button are equal.
  • Shape: Button has many shapes, square-rectangle (default), circle-round, round-full rounded corners.
  • Size: Buttons can be mini, small, medium and large in size, with corresponding height of 24px/28px/32px/36px. The recommended and default size is medium. The suitable size can be selected in different scenarios and different business needs.
  • Status: Buttons can be in warning, danger, and success status. Status can co-exist with type but with higher priority.
  • Disabled: The disabled state of the button.
  • Loading: A button can be on loading state by setting loading. Click events are not triggered when buttons are on loading state.
  • Button group: Button group can be used to group together operation buttons at the same level.
  • Long: The button width adapts to the container width.

Examples come from the official Arco Design repository (MIT) at the commit published as npm 2.66.18. Some use online images or upload endpoints; network requests are disabled in previews.

API

Button

PropertyDescriptionTypeDefaultValue
disabledWhether to disable the buttonboolean-
iconOnlyWhether to show icon only, in which case the button width and height are equal. If icon is specified and there are no children, iconOnly defaults to trueboolean-
loadingWhether the button is in the loading stateboolean-
loadingFixedWidthThe width of the button remains unchanged on loadingboolean-
longWhether the width of the button should adapt to the container.boolean-
hrefThe button behaves like <a> with href as target url.string-
targetThe target attribute of the link, which takes effect when href exists.string-
htmlTypehtml button type'button' | 'submit' | 'reset'button
shapeThree button shapes are available: circle, round and square'circle' | 'round' | 'square'square
sizeSize of the button'mini' | 'small' | 'default' | 'large'default
statusStatus of the button'warning' | 'danger' | 'success' | 'default'default
typeA variety of button types are available: primary, secondary, dashed,text, linear and default which is the secondary.'default' | 'primary' | 'secondary' | 'dashed' | 'text' | 'outline'default
iconIcon of the buttonReactNode-
anchorPropsThe native attribute of the link, which takes effect when href existsHTMLProps<HTMLAnchorElement>-
classNameAdditional css classstring | string[]-
styleAdditional styleCSSProperties-
onClickCallback fired when the button is clicked(e: Event) => void-