项目
在 GitHub 查看
sannajammeh/tw-classed
关于
Monorepo of the TW Classed project. Consists of Core and React packages.
网站与应用开发实测星标增长
- 24小时
- 0
- 7天
- -1
- 15天
- -1
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文
TW Classed
Monorepo of the TW Classed project. Consists of Core and React packages.
React
The react package is a wrapper around the core package that provides an easy to way to create classed components. See the React Docs
// Button.tsx
import { classed } from "@tw-classed/react";
const Button = classed.button("px-4 py-2", {
variants: {
color: {
primary: "bg-blue-500 text-white",
secondary: "bg-gray-500 text-white",
},
},
});
// In your App
const App = () => {
return (
<>
<Button color="primary">Primary</Button>
<Button color="secondary">Secondary</Button>
</>
);
};
Core
The core package is a library that provides a set of functions to help you build your own classed components.
See the Core Docs
import { classed } from "@tw-classed/core";
const button = classed("px-4 py-2", {
variants: {
color: {
primary: "bg-blue-500 text-white",
secondary: "bg-gray-500 text-white",
},
},
});
// In your template
const Button = document.createElement("button");
Button.className = button({ color: "primary" });
// Or with a framework (Like lit-html)
const Button = () => html`<button class="${button({ color: "primary" })}" />`;
License
MIT
Discord community

探索相关项目
加载中…