Skip to content
/ sx Public

jsx pragma factory for the styled system sx prop with theme values, no providers required

Notifications You must be signed in to change notification settings

karlsander/sx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@lightmode/sx

This helper function creates a jsx pragma the enables the Styled System/Theme UI sx prop with a theme and without any provider.

Create your jsx pragma like so:

import { makePragma } from '@lightmode/sx';
import theme from './theme';

const jsx = makePragma(theme);

export default jsx;
export { jsx };

Then use it like the jsx prop from Theme UI but import your own file:

/** @jsx jsx */
import { jsx } from '../util/jsx';

The raw css prop is not supported. An interesting possibilty of this approach (not yet implemented) is providing full typescript support, including custom theme values.

About

jsx pragma factory for the styled system sx prop with theme values, no providers required

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published