0.0.9 • Published 1 year ago

twyled v0.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

twyled

React UI library. Inspired by Tailwind & Styled System

⚠️ Still a work in progress

Usage

import { createTwyled, defaultTheme } from "twyled";

const { twyled, createVariants, ThemeProvider } = createTwyled({
  theme: defaultTheme,
});

const Box = twyled("div");

<Box mb="2" bg="green500" />;

const Flex = twyled("div", {
  defaults: { display: "flex", alignItems: "center" },
});

<Flex gap="4" justifyContent="center">
  <Box>First</Box>
  <Box>Second</Box>
</Flex>;

const Button = twyled("button", {
  variants: createVariants({
    size: {
      medium: {
        fontSize: "base",
        px: 2,
        py: 1.5,
        rounded: "md",
      },
      large: {
        fontSize: "lg",
        px: 2.5,
        py: 2,
        rounded: "lg",
      },
    },
  }),
  defaultVariants: {
    size: "medium",
  },
});

<Button>Medium button</Button>;
<Button size="large">Large button</Button>;

ℹ️ You need to wrap your component tree with ThemeProvider

0.0.3

1 year ago

0.0.2

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.1

1 year ago