๐ง Installation
Install TailwindBox via npm or yarn:
npm install tailwindbox
# or
yarn add tailwindbox
๐ Usage
Here's a quick example of how to use TailwindBox:
import { tw } from "tailwindbox";
function App() {
const isDarkMode = true;
const styles = tw({
base: "p-4 rounded-lg shadow-md",
dark: { if: isDarkMode, classes: "bg-gray-800 text-white" },
light: { if: !isDarkMode, classes: "bg-white text-black" },
});
return <div className={styles}>Hello, TailwindBox!</div>;
}
export default App;
-
base
: Always applies the base styles (p-4 rounded-lg shadow-md
). -
dark
: Appliesbg-gray-800 text-white
only ifisDarkMode
is true. -
light
: Appliesbg-white text-black
only ifisDarkMode
is false.
๐ Features
- Object-Like Structure: Define TailwindCSS styles in an object-basedโฆ