Skip to content

A utility that makes using Facebook's StyleX easier, with support for Tailwind-style syntax

License

Notifications You must be signed in to change notification settings

tinyhref/use-stylex

Repository files navigation

use-stylex

Installation

npm install use-stylex
or
yarn add use-stylex

Use It

import * as stylex from '@stylexjs/stylex';
import { useStyleX } from 'use-stylex';

const styles = stylex.create({
  wrapper: {
    position: 'relative'
  },
  base: {
    display: 'flex',
    color: '#fff'
  },
  primary: {
    color: 'blue'
  }
})

const Component = () => {
  const { classes } = useStyleX(styles);

  return (
    <div
      className={classes.wrapper || classes.getClass('base', 'primary', 'absolute') || classes.tailwind('absolute')}
    >
      Component
    </div>
  )
}

About

A utility that makes using Facebook's StyleX easier, with support for Tailwind-style syntax

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published