# @styled-system/variant

> Read the docs: https://styled-system.com/variants

Latest version **5.1.5** (published 2020-02-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install @styled-system/variant
pnpm add @styled-system/variant
yarn add @styled-system/variant
bun add @styled-system/variant
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 5.1.5 |
| Published | 2020-02-17 |
| First published | 2019-05-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 10.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Brent Jackson |
| Maintainers | jxnblk |

## Links

- npm: https://www.npmjs.com/package/@styled-system/variant
- npm.io page: https://npm.io/package/@styled-system/variant

## Dependencies (2)

- [@styled-system/css](https://npm.io/package/@styled-system/css.md) ^5.1.5
- [@styled-system/core](https://npm.io/package/@styled-system/core.md) ^5.1.2

## Recent versions

- 5.1.5 (latest) — 2020-02-17
- 5.0.0-12 (next) — 2019-06-02
- 5.0.0-alpha.0 (alpha) — 2019-05-28
- 5.1.4 — 2019-12-02
- 5.1.2 — 2019-09-11
- 5.1.1 — 2019-08-22
- 5.1.0 — 2019-08-12
- 5.0.21 — 2019-08-08
- 5.0.18 — 2019-07-31
- 5.0.16 — 2019-07-22
- 5.0.15 — 2019-07-15
- 5.0.12 — 2019-06-25
- 5.0.5 — 2019-06-03
- 5.0.4 — 2019-06-03
- 5.0.3 — 2019-06-03
- … 10 more at https://npm.io/package/@styled-system/variant/versions

## README

# @styled-system/variant

Read the docs: https://styled-system.com/variants

## Usage

```js
import styled from 'styled-components'
import variant from '@styled-system/variant'

const Button = styled('button')(
  variant({
    variants: {
      primary: {
        color: 'white',
        bg: 'primary',
        ':hover': {
          bg: 'black',
        }
      },
      secondary: {
        color: 'white',
        bg: 'secondary',
        ':hover': {
          bg: 'black',
        }
      },
    }
  })
)

// <Button variant='primary' />
// <Button variant='secondary' />
```

## Options

- `variants`: object of theme-aware variant styles with user-defined shape
- `prop`: (default `variant`) custom prop name for variant
- `scale`: optional theme key for adding variants to the theme object

MIT License

---
_Source: https://npm.io/package/@styled-system/variant · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
