0.1.1 • Published 8 months ago

stylex-variants v0.1.1

Weekly downloads
-
License
MIT
Repository
-
Last release
8 months ago

StyleX Variants

Example

import stylex from '@stylexjs/stylex';
import { sv } from 'stylex-variants';

const styles = stylex.create({
  base: {
    padding: '10rem',
  },
  sizeLg: {
    height: '2rem',
  },
  sizeMd: {
    height: '1.5rem',
  },
});

const variants = sv({
  base: styles.base,
  variants: {
    size: {
      lg: styles.sizeLg,
      md: styles.sizeMd,
    },
  },
  defaultVariants: {
    size: 'md',
  },
});

const styleProps = stylex.props(variants({ size: 'lg' }));
// will result in
const styleProps = stylex.props(styles.base, styles.sizeLg);
0.1.1

8 months ago

0.1.0

9 months ago

0.0.3

9 months ago

0.0.2

9 months ago

0.0.1

9 months ago