# @class101/styled-system__theme-get

> The `themeGet` function is an existential getter function that can be used in any style declaration to get a value from your theme, with support for fallback values. This helps prevent errors from throwing when a theme value is missing, which can be helpf

Latest version **5.3.3** (published 2021-11-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install @class101/styled-system__theme-get
pnpm add @class101/styled-system__theme-get
yarn add @class101/styled-system__theme-get
bun add @class101/styled-system__theme-get
```

## 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.3.3 |
| Published | 2021-11-01 |
| First published | 2021-09-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 2.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Brent Jackson |
| Maintainers | bae, hrg921, tbvjaos510, ihello0720, sukjae, seozi, mango906, mu29, jhn3981, noel-101inc, harry-101, hanshans, nbsp1221, inyeop0212, kang-heewon, neroli-class101, rubenhur |

## Links

- npm: https://www.npmjs.com/package/@class101/styled-system__theme-get
- npm.io page: https://npm.io/package/@class101/styled-system__theme-get

## Dependencies (1)

- [@class101/styled-system__core](https://npm.io/package/@class101/styled-system__core.md) ^5.3.3

## Recent versions

- 5.3.3 (latest) — 2021-11-01
- 5.3.2 — 2021-11-01
- 5.3.1 — 2021-09-14

## README

# @class101/styled-system__theme-get

The `themeGet` function is an existential getter function
that can be used in any style declaration to get a value
from your theme, with support for fallback values.
This helps prevent errors from throwing when a theme value is missing,
which can be helpful when unit testing styled-components.

```sh
npm i @class101/styled-system__theme-get
```

```js
themeGet(objectPath, fallbackValue)(props)
```

`themeGet` returns a function that accepts props as an argument
(`themeGet(objectPath)(props)`), which when used in a tagged template
literal should look like this:

```js
import styled from 'styled-components'
import { themeGet } from '@class101/styled-system__theme-get'

const Box = styled.div`
  border-radius: ${themeGet('radii.small', '4px')};
`
```

When used with object literal syntax, `themeGet` needs to be in a
function call and have `props` passed to it:

```js
import styled from 'styled-components'
import { themeGet } from '@class101/styled-system__theme-get'

const Box = styled('div')(props => ({
  borderRadius: themeGet('radii.small', '4px')(props),
}))
```

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