5.1.2 • Published 5 years ago

@styled-system/theme-get v5.1.2

Weekly downloads
40,010
License
MIT
Repository
-
Last release
5 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@pingux/astro@primer/components@primer/react@revolut/ui-kitcunei-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-theme@opencollective/frontend-componentslucas-test-design-systemmdlz-prmtz@elwood-studio/primer-components@emcasa/ui@emcasa/ui-dommanoamasterpiece-uineat-design-systemnetflox@jordanwade/react-embed-widgetreact-birchreact-basic-kit@gatsbyjs/gatsby-theme-websiteorcs-design-system@fuji-ui/core@freenow/wavepalette-mobile@hygraph/baukastenpipeline-ui@hack4impact-uiuc/bridge@griddo/ax@envio-ui/helpers@envio-ui/react@ethomson/gatsby-theme-npm-doctocatnpm-all-packages@etvas/etvaskit@etvas/etvaskit-2@magicsoup.io/instantreact-oak@matoa-ui/components@liinkiing/klee@lote-design-system/core@lightspeed/cirrus@lightspeed/cirrus-datepicker@lightspeed/cirrus-ls-logo@lightspeed/cirrus-nps@lightspeed/cirrus-sidebar@lightspeed/cirrus-spotlight@lightspeed/cirrus-table@lightspeed/cirrus-wordmark@lightspeed/flame@kevinnhansenn/palette-mobile@learnn/designnreact-kit-coreprimer-docz-themeopen-palette@felipebarso/primer-react@graphemic/componentspcln-popoverpcln-carouselpcln-design-systempcln-iconspcln-menupcln-modal@obigtech/uirimble-ui@olist/ui-commons@olist/united@nulogy/components@prifina-apps/newmuzzler@primer/gatsby-theme-doctocat@recollector-app/components@mkplace-adm/shared@mkplace/admin-sharedrealsoftworks-decor-tmp@modulz/radix@maxio-com/self-service@metrewards/react-components@open-codes/opencodesstyled-nativestyled-system-uistyled-react-ui-libsstyled-ui-web@raid/basic-kit@raid/markdown-kit@raid/ui-core
5.1.2

5 years ago

5.1.1

5 years ago

5.1.0

5 years ago

5.0.21

5 years ago

5.0.18

5 years ago

5.0.16

5 years ago

5.0.15

5 years ago

5.0.12

5 years ago

5.0.6

5 years ago

5.0.5

5 years ago

5.0.4

5 years ago

5.0.3

5 years ago

5.0.2

5 years ago

5.0.1

5 years ago

5.0.0

5 years ago

5.0.0-12

5 years ago

5.0.0-11

5 years ago

5.0.0-7

5 years ago

5.0.0-alpha.0

5 years ago

5.0.0-5

5 years ago

5.0.0-3

5 years ago

5.0.0-2

5 years ago

5.0.0-1

5 years ago

5.0.0-0

5 years ago