System
The low-level utility for creating your system props
createSystem
Your system props start here! This function receives a configuration object:
strict
: Optionally constrain system prop values to values from the theme object.pseudoSelectors
: Define a map of component prop (key) to a pseudo selector (value)tokenPrefix
: Set whether or not to use the$
prefix for accessing theme values. Set to'noprefix'
for styled-system compatability.
system
createSystem
will return to you your system
, which in turn takes a configuration object. Its keys will become your system props. You can spread into it any of the utility groups provided by this library or define your own custom system props.
Each key in the configuration object can define the following:
property
: the CSS property to use in the returned style objectproperties
: an array of multiple properties (e.g.[ 'marginLeft', 'marginRight' ]
)scale
: a string referencing a key in thetheme
objecttransform
: a function to transform the raw value based on the scaledefaultScale
: a fallback scale object for when there isn't one defined in the theme object
For example:
By default, Styled System will return a value from the theme based on a key, or, if strict
was disabled in createSystem
, the raw value. To change how a style prop value is transformed, provide a custom transform
function.