Skip to content

Tiny utility library for React that let's you create reusable components with dynamic classNames, allowing flexible customization of styles and behavior based on props.

License

Notifications You must be signed in to change notification settings

VacaSan/classified

Repository files navigation

classified

// TODO

Usage

npm install --save @vacasan/classified
import React from 'react';
import { classified } from "@vacasan/classified";

const Button = classified("button")([
  "btn",
  ({ variant = "primary" }) => `btn-${variant}`,
  ({ block }) => block && "btn-block"
]);

<Button>Ok</Button> // <button className="btn btn-primary">
<Button variant="secondary">Cancel</Button> // <button className="btn btn-secondary" />
<Button className="special">Special</Button> // <button className="btn btn-primary special" />
<Button block>Click me!</Button> // <button className="btn btn-primary btn-block" />

About

Tiny utility library for React that let's you create reusable components with dynamic classNames, allowing flexible customization of styles and behavior based on props.

Topics

Resources

License

Stars

Watchers

Forks

Packages