1.0.27 • Published 2 years ago

@twilentui/style v1.0.27

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@twilentui/style

Installation

yarn add @twilentui/style

Declare Provider

import { StyledProvider } from "@twilentui/style";

<StyledProvider>/* ... */</StyledProvider>;

Basic Usage

import { tw, twilent } from "@twilentui/style";

Function

const Button = twilent("button", {
  style: () => `background-color: #000;color:#fff;`,
});

export const CustomButton = (props: ButtonProps) => {
  const [count, setCount] = useState(0);

  return (
    <Button
      id="example-button"
      px="2rem"
      py="1.5rem"
      onClick={() => setCount(count + 1)}
      {...props}
    >
      {props.text} {count}
    </Button>
  );
};

Component

export const CustomButton = (props: ButtonProps) => {
  const [count, setCount] = useState(0);

  return (
    <tw.button
      id="example-button"
      px="2rem"
      py="1.5rem"
      onClick={() => setCount(count + 1)}
      bgColor="#000"
      color="#fff"
      {...props}
    >
      {props.text} {count}
    </tw.button>
  );
};

Rendered HTML

<button id="example-button" class="css-1y3oax1-twilent">
  Clicked this many times: 0
</button>

Rendered Stylesheet

.css-1y3oax1-twilent {
  padding-top: 1.5rem;
  padding-right: 2rem;
  padding-bottom: 1.5rem;
  padding-left: 2rem;
  background-color: red;
}
1.0.27

2 years ago

1.0.26

2 years ago

1.0.25

2 years ago

1.0.24

2 years ago

1.0.23

2 years ago

1.0.22

2 years ago

1.0.21

2 years ago

1.0.20

2 years ago

1.0.19

2 years ago

1.0.18

2 years ago

1.0.17

2 years ago

1.0.16

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago