# @s-ui/react-atom-button

> Atom Element: SUI button

Latest version **2.5.0** (published 2025-12-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install @s-ui/react-atom-button
pnpm add @s-ui/react-atom-button
yarn add @s-ui/react-atom-button
bun add @s-ui/react-atom-button
```

## Health

**Score 50/100 (C)** — status: stable.

Positive: no vulnerabilities; high maintenance score.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 2.5.0 |
| Published | 2025-12-18 |
| First published | 2020-01-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 40.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 146 |
| Maintainers | ivanmlaborda, salvador.juan, andresin87.adevinta, izeller, gfabregoadv, ignacio_navarro, oscar_ramirez, jordi.munoz, luis-garrido, jenifer.lopez, isabelgomez87, pa.chruscinski.ext, schibstedspain, belen.santos, xavi_ballestar, ferrangbtw, sabri-castelli, jamile.radloff, davidmartin2108, sergi.quintela, estefania_garcia, arnau.guell, ferran.simon, victor.perez.adevinta, mariapaula.forero.ext, oscar.gomez, david.nieto, oriol.puig, nacho_torrella, xavi.murcia, ignacio.rodriguez, francisco.ruiz.lloret, sziauberyte, andresadv, javiauso, alverd004, marian.lucaci, pablogs, sergiocollado, pablo.rey-adevinta, beatrizip, david.cuadrado.ext, giovanny.sayas.ext, patricio.sartore, azahara, sergio.escano, pol.valls, hpintos_adevinta, oscar-raig-adevinta, thomas.page.ext, sebastian.badea.adevinta, victoria.pasichnyk.ext, sendami.luque.ext, luz_adv, ruben-martin, emiliovz, arturo.vicente, diegomr, sergi.martinez.adevinta, guillemgc3, javiermiguel, atilioscolaroadv, florinz, denis_z, anya_ok, hector-prieto-moreno, mirceasima-adv |
| Keywords | @s-ui, react, component, atom, button |

## Links

- npm: https://www.npmjs.com/package/@s-ui/react-atom-button
- Repository: https://github.com/SUI-Components/sui-components
- Homepage: https://sui-components.vercel.app/
- Issues: https://github.com/SUI-Components/sui-components/issues?q=is%3Aopen+label%3A%22Component%3A+button%22
- npm.io page: https://npm.io/package/@s-ui/react-atom-button

## Dependencies (3)

- [@s-ui/component-dependencies](https://npm.io/package/@s-ui/component-dependencies.md) latest
- [@s-ui/react-primitive-loading-icon](https://npm.io/package/@s-ui/react-primitive-loading-icon.md) 1
- [@s-ui/react-primitive-polymorphic-element](https://npm.io/package/@s-ui/react-primitive-polymorphic-element.md) 1

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 2.5.0 (latest) — 2025-12-18
- 2.0.0-beta.2 (beta) — 2023-01-20
- 2.4.0 — 2025-09-08
- 2.3.0 — 2025-09-05
- 2.2.0 — 2025-05-29
- 2.1.0 — 2025-05-26
- 2.0.0 — 2025-05-05
- 1.100.0 — 2025-03-13
- 1.99.0 — 2025-03-06
- 1.98.0 — 2025-02-04
- 1.97.0 — 2025-01-26
- 1.96.0 — 2024-05-22
- 1.95.0 — 2024-05-09
- 1.94.0 — 2024-05-08
- 1.93.0 — 2024-05-06
- … 60 more at https://npm.io/package/@s-ui/react-atom-button/versions

## README

# Button

> Atom Element: SUI button

[![documentation](https://img.shields.io/badge/read%20the%20doc-black?logo=readthedocs)](https://sui-components.vercel.app/workbench/atom/button/)
[![issue](https://img.shields.io/badge/report%20a%20bug-black?logo=openbugbounty&logoColor=red)](https://github.com/SUI-Components/sui-components/issues/new?&projects=4&template=bug-report.yml&assignees=&template=report-a-bug.yml&title=🪲+&labels=bug,component,atom,button)
[![npm](https://img.shields.io/npm/dt/%40s-ui/react-atom-button?logo=npm&labelColor=black)](https://www.npmjs.com/package/@s-ui/react-atom-button)

[![Issues open](https://img.shields.io/github/issues-search/SUI-Components/sui-components?query=is%3Aopen%20label%3Acomponent%20label%3Abutton&logo=openbugbounty&logoColor=red&label=issues%20open&color=red)](https://github.com/SUI-Components/sui-components/issues?q=is%3Aopen+label%3Acomponent+label%3Abutton)
[![NPM](https://img.shields.io/npm/l/%40s-ui%2Freact-atom-button)](https://github.com/SUI-Components/sui-components/blob/main/components/atom/button/LICENSE.md)

## Installation

```sh
$ npm install @s-ui/react-atom-button --save
```

## Usage

### Basic usage

```js
import Button from '@s-ui/react-atom-button'

return (
  <div>
    <Button>Normal</Button>
    <Button focused>Focused</Button>
    <Button size="large" disabled>
      Disabled
    </Button>
  </div>
)
```

### Flexible props

All props available from regular buttons can be used.

```js
import Button from '@s-ui/react-atom-button'

return (
  <div>
    <Button onClick={() => alert('Primary with onClick')}>Primary with onClick</Button>
    <Button type="accent" title="Title: Lorem Ipsum">
      Accent with title
    </Button>
    <Button type="secondary" className="customClass">
      Secondary with className
    </Button>
  </div>
)
```

### Button with AtomIcon

You could use the `AtomButton` along the `AtomIcon` in order to show the button text with an icon. The proper `size` and `color` of the `AtomIcon` will be used according to the needs of the `AtomButton` definition.

```js
import Button from '@s-ui/react-atom-button'
import AtomIcon from '@s-ui/react-atom-icon'

const Icon = (
  <AtomIcon>
    <svg viewBox="0 0 24 24">
      <path d="M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z" />
    </svg>
  </AtomIcon>
)

return (
  <div>
    <Button leftIcon={Icon} />
    <Button size="large" rightIcon={Icon}>
      Large icon
    </Button>
    <Button size="small" rightIcon={Icon}>
      Small icon
    </Button>
  </div>
)
```

### Button shape

Use `shape` prop to modify the border radius of the component. Choose between: `squared`, `rounded` and `circular`

```js
import Button, {atomButtonShapes} from '@s-ui/react-atom-button'

return (
  <>
    <AtomButton shape={atomButtonShapes.SQUARED} />
    <AtomButton shape={atomButtonShapes.ROUNDED} />
    <AtomButton shape={atomButtonShapes.CIRCULAR} />
  </>
)
```

### Button loading

Set `isLoading` prop to display the loading state of a button. Optionally, use `loader` prop if you want to overwrite the default spinner and `loadingText` prop if you want to display some text next to the `loader`.

```js
import Button from '@s-ui/react-atom-button'

return (
  <>
    <AtomButton isLoading />
    <AtomButton loadingText="Submitting" isLoading />
  </>
)
```

### Button with elevation

Set `elevation` prop to display a shadow around the button. If it's not set no shadow will be shown.

```js
import Button from '@s-ui/react-atom-button'
return (
  <>
    <Button elevation="medium">Example</Button>
    <Button elevation="large">Example</Button>
  </>
)
```

### Button inside Form

By default `AtomButton` inside a `form` will submit the form

```js
import Button from '@s-ui/react-atom-button'

return (
  <form onSubmit={() => window.alert('Submit!')}>
    <div>
      <input type="text" placeholder="Put your name" />
    </div>
    <div>
      <Button>Submit</Button>
    </div>
  </form>
)
```

If we need several `AtomButton` inside a form we can specify which one we want to submit the form w/ props `isButton` and `isSubmit`

```js
import Button from '@s-ui/react-atom-button'

return (
  <form onSubmit={() => window.alert('Submit!')}>
    <div>
      <input type="text" placeholder="Put your name" />
    </div>
    <div>
      <Button isButton onClick={() => window.alert('Click!')}>
        Click Me!
      </Button>
      <Button isButton onClick={() => window.alert('Click!')}>
        Click Me!
      </Button>
    </div>
    <div>
      <Button isSubmit>Submit</Button>
    </div>
  </form>
)
```

### Rendering a link

When `link` property is passed, the component will render an html link.

```js
import Button from '@s-ui/react-atom-button'

return (
  <Button link href="https://www.adevinta.com" target="_blank" rel="nofollow noopener">
    Link
  </Button>
)
```

output:

```html
<a class="sui-AtomButton sui-AtomButton--link" href="https://www.adevinta.com" target="_blank">Link</a>
```

> **Find full description and more examples in the [demo page](https://sui-components.now.sh/workbench/atom/button).**

---
_Source: https://npm.io/package/@s-ui/react-atom-button · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
