
Security News
Rolldown Pulls Rust React Compiler Integration After Binary Size Increase
Rolldown paused Rust React Compiler integration after a 5MB binary size increase raised concerns about shipping React-specific code to all Vite users.
@styled-system/jsx
Advanced tools
Custom JSX pragma for css prop with Styled System - built with Emotion
/** @jsx jsx */
import jsx from '@styled-system/jsx'
export default props =>
<div
{...props}
css={{
fontSize: 32,
// use theme values
color: 'primary',
// responsive arrays
padding: [ 2, 3, 4 ],
// use shorthands
mx: 'auto',
}}
/>
css propstyled HOC API requiredIf you're already using JSX syntax, the most explicit way to use Styled System JSX is by adding a custom pragma to the top of any module that uses the pragma.
/** @jsx jsx */
import jsx from '@styled-system/jsx'
This is similar to what the Emotion plugin does, so the Emotion plugin should be disabled when using this one instead.
For any module with the custom pragma enabled, use Styled System shortcuts, responsive arrays and theme values directly in the css prop.
<div
css={{
px: 3,
py: 4,
mb: 4,
bg: 'primary'
}}
/>
To use explicit values instead of referencing values from the theme, use a value that will not be interpreted as an object key.
For example, use 2px instead of 2 (which would pick up the space[2] value.
<div css={{ mb: '2px' }} />
To create reusable styled components, wrap an element like so.
/** @jsx jsx */
import jsx from '@styled-system/jsx'
export const Button = ({
primary,
...props
}) =>
<button
{...props}
css={{
color: 'white',
bg: primary ? 'primary' : 'secondary',
}}
/>
width fractionsMIT License
FAQs
Custom JSX pragma for `css` prop with Styled System - built with [Emotion][]
The npm package @styled-system/jsx receives a total of 216 weekly downloads. As such, @styled-system/jsx popularity was classified as not popular.
We found that @styled-system/jsx demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Rolldown paused Rust React Compiler integration after a 5MB binary size increase raised concerns about shipping React-specific code to all Vite users.

Security News
/Research
Mini Shai-Hulud expands into the Go ecosystem after hitting LeoPlatform npm packages and targeting GitHub Actions workflows.

Security News
The Fable shutdown shows how quickly model access can become a business continuity risk for AI-dependent engineering teams.