5.1.2 • Published 6 years ago

@styled-system/theme-get v5.1.2

Weekly downloads
40,010
License
MIT
Repository
-
Last release
6 years ago

@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.

npm i @styled-system/theme-get
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:

import styled from 'styled-components'
import { themeGet } from '@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:

import styled from 'styled-components'
import { themeGet } from '@styled-system/theme-get'

const Box = styled('div')(props => ({
  borderRadius: themeGet('radii.small', '4px')(props),
}))
@yattho/gatsby-theme-rigitus@yattho/react@adapt-design-system/core@3wirebuild/styled-system@primer/componentscunei-styled-ui@thesaurus/componentspa-temp-design-system@pixelmord/prestyledmy-test-vimal-componentsvtest-cmp@hack4impact-uiuc/design@blend-ui/testsui-gatsby@lotter-system/core@cuneilego/styled-elements@testing-ui/core@plum-xoxo/stores-dsm@everything-registry/sub-chunk-878@buoysoftware/anchor-themexdefi-common-uithree-divers-ui@croudio/editor@cuneilego/core@cuneilego/web@doors/core@bofink/ui@blasterjs/core@prifina-apps/newmuzzlerisland-uiisland-ui-systemstyled-ui-webstyled-react-ui-libsstyled-nativestyled-system-uistinodes-uiucc-design-systemugnisuifabtest-bcc-design-system@artsy/palette@artsy/palette-charts@artsy/palette-mobile@apollosproject/apollos-embeds@auspices/eos@aksara-ui/helpers@aksara-ui/react@alphalets-ui/core@aflorithmic/aflr-storybook@bestyled/system@blend-ui/borderless-input@blend-ui/borderless-textarea@blockstack/ui@bridgetool/gatsby-theme-dev@builder-plugins/core@catchandrelease/arbor@cap-collectif/ui@cbryant24/styled-react@class101/ui-system@chatterbug/aaron@aaiello/rimble-ui@containous/faency@cogito-study/alea@coinjoss-ui/core@bonobolabs/mds-web-ui@bonobolabs/mds-web-ui-gatsby@bonobolabs/mds-web-ui-reach@dasa-health/components-react@felipebarso/primer-react@hack4impact-uiuc/bridge@griddo/ax@graphemic/components@hygraph/baukasten@elwood-studio/primer-components@emcasa/ui@emcasa/ui-dom@gatsbyjs/gatsby-theme-website@fuji-ui/core@freenow/wave@ethomson/gatsby-theme-npm-doctocat@etvas/etvaskit@etvas/etvaskit-2@learnn/designn@lote-design-system/core@liinkiing/klee@lightspeed/cirrus-datepicker@lightspeed/cirrus-ls-logo@lightspeed/cirrus-nps@lightspeed/cirrus-sidebar@lightspeed/cirrus-spotlight@lightspeed/cirrus-table@lightspeed/cirrus-wordmark@lightspeed/flame@lightspeed/cirrus@magicsoup.io/instant@maxio-com/self-service@metrewards/react-components@matoa-ui/components@envio-ui/helpers@envio-ui/react
5.1.2

6 years ago

5.1.1

6 years ago

5.1.0

6 years ago

5.0.21

6 years ago

5.0.18

6 years ago

5.0.16

6 years ago

5.0.15

6 years ago

5.0.12

6 years ago

5.0.6

6 years ago

5.0.5

6 years ago

5.0.4

6 years ago

5.0.3

6 years ago

5.0.2

6 years ago

5.0.1

6 years ago

5.0.0

6 years ago

5.0.0-12

6 years ago

5.0.0-11

6 years ago

5.0.0-7

6 years ago

5.0.0-alpha.0

6 years ago

5.0.0-5

6 years ago

5.0.0-3

6 years ago

5.0.0-2

6 years ago

5.0.0-1

6 years ago

5.0.0-0

6 years ago