Package Exports
- @styled-system/css
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@styled-system/css) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@styled-system/css
Styled System for your css prop
npm i @styled-system/cssStyled System CSS lets you write style objects with responsive, theme-aware Styled System shortcuts.
// usage with the css prop
import React from 'react'
import css from '@styled-system/css'
const Beep = props =>
<div
{...props}
css={css({
fontSize: [4, 5, 6],
color: 'primary',
})}
/>// usage with styled components
import styled from '@emotion/styled'
import css from '@styled-system/css'
const Boop = styled(
css({
fontSize: [ 4, 5, 6 ],
color: 'primary',
bg: 'gray',
'&:hover': {
color: 'secondary',
},
})
)Keys
The following keys in your style object will work the same as Styled System props, pulling values from your theme object and converting arrays to responsive styles.
fontFamilyfontSizefontWeightlineHeightcolorbg,backgroundColorm,marginmt,marginTopmr,marginRightmb,marginBottomml,marginLeftmxmyp,paddingpt,paddingToppr,paddingRightpb,paddingBottompl,paddingLeftpxpy
In this example, fontSize accepts an array, and borderBottom is passed through as plain CSS.
<div
css={css({
// Styled System key
fontSize: [ 3, 4, 5 ],
// CSS property
borderBottom: '2px solid tomato',
})}
/>Props
When using @styled-system/css with styled components,
Styled System props can be used on the resulting component.
<Beep
color='primary'
bg='black'
/>MIT License