# @styled-system/css

> Styled System for the `css` prop

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

## Install

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

## Health

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

Positive: has types package; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 5.1.5 |
| Published | 2020-02-17 |
| First published | 2019-03-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/styled-system__css) |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 15.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Brent Jackson |
| Maintainers | jxnblk |
| Keywords | css, css-in-js, emotion, styled-components, style, react |

## Links

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

## Alternatives

- [style-dictionary](https://npm.io/package/style-dictionary.md) — 2.0M weekly downloads
- [postcss-merge-idents](https://npm.io/package/postcss-merge-idents.md) — 1.7M weekly downloads
- [@fontsource/noto-sans](https://npm.io/package/@fontsource/noto-sans.md) — 93.0K weekly downloads
- [uglifycss](https://npm.io/package/uglifycss.md) — 71.6K weekly downloads
- [mat4-interpolate](https://npm.io/package/mat4-interpolate.md) — 23.3K weekly downloads

## 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.0.23 — 2019-08-12
- 5.0.22 — 2019-08-09
- 5.0.21 — 2019-08-08
- 5.0.20 — 2019-08-07
- 5.0.19 — 2019-08-05
- 5.0.17 — 2019-07-25
- 5.0.16 — 2019-07-22
- 5.0.13 — 2019-07-05
- 5.0.11 — 2019-06-24
- 5.0.10 — 2019-06-19
- 5.0.9 — 2019-06-18
- … 26 more at https://npm.io/package/@styled-system/css/versions

## README

# @styled-system/css

Styled System for the `css` prop

```sh
npm i @styled-system/css
```

Styled System CSS lets you write style objects with responsive, theme-aware Styled System shortcuts.

```jsx
// usage with the css prop
import React from 'react'
import css from '@styled-system/css'

const Beep = props =>
  <div
    {...props}
    css={css({
      fontSize: [4, 5, 6],
      color: 'primary',
    })}
  />
```

```js
// usage with a styled HOC
import styled from '@emotion/styled'
import css from '@styled-system/css'

const Boop = styled('div')(
  css({
    fontSize: [ 4, 5, 6 ],
    color: 'primary',
    bg: 'gray',
    '&:hover': {
      color: 'secondary',
    },
  })
)
```

To make the css prop work with `styled-components`, `babel-plugin-styled-components` must be enabled.

## Theme Keys

The following keys in your style object will work the same as Styled System props, pulling values from your `theme` object.

Property  | Theme Key
---|---
`fontFamily` | `fonts`
`fontSize` | `fontSizes`
`fontWeight` | `fontWeights`
`lineHeight` | `lineHeights`
`letterSpacing` | `letterSpacings`
`color` | `colors`
`backgroundColor`, `bg` | `colors`
`margin`, `m` | `space`
`marginTop`, `mt` | `space`
`marginRight`, `mr` | `space`
`marginBottom`, `mb` | `space`
`marginLeft`, `ml` | `space`
`marginX`, `mx` | `space`
`marginY`, `my` | `space`
`padding`, `p` | `space`
`paddingTop`, `pt` | `space`
`paddingRight`, `pr` | `space`
`paddingBottom`, `pb` | `space`
`paddingLeft`, `pl` | `space`
`paddingX`, `px` | `space`
`paddingY`, `py` | `space`
`top` | `space`
`bottom` | `space`
`left` | `space`
`right` | `space`
`border` | `borders`
`borderTop` | `borders`
`borderRight` | `borders`
`borderBottom` | `borders`
`borderLeft` | `borders`
`borderColor` | `colors`
`borderWidth` | `borderWidths`
`borderStyle` | `borderStyles`
`borderRadius` | `radii`
`boxShadow` | `shadows`
`textShadow` | `shadows`
`zIndex` | `zIndices`
`width` | `sizes`
`minWidth` | `sizes`
`maxWidth` | `sizes`
`height` | `sizes`
`minHeight` | `sizes`
`maxHeight` | `sizes`
`size` | `sizes`

## Responsive Arrays

All CSS properties accept arrays as values for responsive styles.

```jsx
<div
  css={css({
    fontSize: [ 4, 5, 6 ],
  })}
/>
```

In this example, `fontSize` accepts an array, picking up values from the `theme.fontSizes` scale, and `borderBottom` is passed through as plain CSS.

```jsx
<div
  css={css({
    // Styled System key
    fontSize: [ 3, 4, 5 ],
    // CSS property
    borderBottom: '2px solid tomato',
  })}
/>
```

MIT License

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