1.0.27 • Published 3 years ago
@twilentui/style v1.0.27
@twilentui/style
Installation
yarn add @twilentui/styleDeclare 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
3 years ago
1.0.26
3 years ago
1.0.25
3 years ago
1.0.24
3 years ago
1.0.23
3 years ago
1.0.22
3 years ago
1.0.21
3 years ago
1.0.20
3 years ago
1.0.19
3 years ago
1.0.18
3 years ago
1.0.17
3 years ago
1.0.16
3 years ago
1.0.15
3 years ago
1.0.14
3 years ago
1.0.13
3 years ago
1.0.12
3 years ago
1.0.11
3 years ago
1.0.10
3 years ago
1.0.9
3 years ago
1.0.8
3 years ago
1.0.6
3 years ago
1.0.5
3 years ago
1.0.4
3 years ago
1.0.3
3 years ago
1.0.2
3 years ago
1.0.1
3 years ago
1.0.0
3 years ago