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-systemcunei-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-uiisland-uiisland-ui-systemhotel-nextlucas-test-design-systemmanoamasterpiece-uimdlz-prmtzlambdatestprimer@welina/manoa@twilio-labs/match@twilio-paste/styling-library@union/components@union/ts-components@thesaurusds/components@vashafarisi/react@yfi/design@zalastax/nolb-_styadonimals-uiapollos-web-embedsgatsby-theme-affiliategatsby-theme-careersgatsby-affiliate-themegatsby-theme-doctocatgatsby-theme-doctornpmgatsby-theme-primergatsby-theme-primer-wikigatsby-theme-gatsbyjs-websitegatsby-theme-wikinotesduodealer-design-systemelemental-reactdocz-theme-primercomrade-components-reactconnect-atom-designchaser-componentschakra-uicl-design-systemcoppolacycloffix-test-design-system-2design-system-setupbdd-docsbig-design-uicabana-reactboinastyled-ui-webstyled-react-ui-libsstyled-nativestyled-system-uistinodes-uiucc-design-systemugnisuifabtest-bcc-design-system@graphemic/componentsneat-design-systemorcs-design-systemopen-palettepcln-menupcln-modalpcln-popoverpcln-design-systempcln-iconspcln-carouselpalette-mobilereact-basic-kitreact-birchreact-kit-coreprimer-docz-themenetfloxpipeline-uirimble-uirealsoftworks-decor-tmpreact-oakgrape-ui-react@dasa-health/components-react@doors/core@etvas/etvaskit@etvas/etvaskit-2@envio-ui/react@envio-ui/helpers
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

7 years ago

5.0.5

7 years ago

5.0.4

7 years ago

5.0.3

7 years ago

5.0.2

7 years ago

5.0.1

7 years ago

5.0.0

7 years ago

5.0.0-12

7 years ago

5.0.0-11

7 years ago

5.0.0-7

7 years ago

5.0.0-alpha.0

7 years ago

5.0.0-5

7 years ago

5.0.0-3

7 years ago

5.0.0-2

7 years ago

5.0.0-1

7 years ago

5.0.0-0

7 years ago