# styled-values

> css-in-js helper that returns first truthy css value from a given map

Latest version **1.1.1** (published 2019-07-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install styled-values
pnpm add styled-values
yarn add styled-values
bun add styled-values
```

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2019-07-18 |
| First published | 2019-06-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 2.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Neek Sandhu |
| Maintainers | sweetslush |
| Keywords | styled-components, css-in-js, classnames, props, properties |

## Links

- npm: https://www.npmjs.com/package/styled-values
- Repository: https://github.com/NeekSandhu/styled-values
- Homepage: https://github.com/NeekSandhu/styled-values#readme
- Issues: https://github.com/NeekSandhu/styled-values/issues
- npm.io page: https://npm.io/package/styled-values

## 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

- 1.1.1 (latest) — 2019-07-18
- 1.1.0 — 2019-06-04
- 1.0.0 — 2019-06-03

## README

## Usage

```bash
npm i styled-values
```

```ts
import styled from 'styled-components'
import v from 'styled-values'

interface FlexboxProps {
  row: boolean;
  col: boolean;
  reversed: boolean;
}

export const Flexbox = styled.div<Partial<FlexboxProps>>`
  display: flex;
  width: 100%;
  height: 100%;
  flex-direction: ${v(({ row, col, reversed }) => ({
    'row-reverse': row && reversed,
    'col-reverse': col && reversed,
    column: col,
    row,
  }))};
  align-items: center;
  border-radius: 4px;
`
```

> Make sure the value mappings are sorted from most specific to least specific. `styled-values` will simply return the first entry with a truthy value. That is why `col && reversed` etc. were placed before just `col` or `row`.

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