@classed/preact
v0.2.0
Published
Classed components for Preact
Downloads
439
Maintainers
Readme
@classed/preact
Introduction
Classed components for Preact.
Installation
npm install @classed/preact
# or
yarn add @classed/preact
# or
pnpm add @classed/preact
# or
bun add @classed/preact
Examples
basic
with classed utils cx
import classed from "@classed/preact";
// components
const Button = classed("button", "btn", "btn-primary", "btn-medium");
// render
<Button class={["extra", "class" /* any cx ClassedClassValue */]}>button</Button>;
custom concatenation
with clsx
import { create } from "@classed/preact";
import clsx from "clsx";
const classed = create({ cx: clsx });
// components
const Button = classed("button", "btn", "btn-primary", "btn-medium");
// render
<Button class={["extra", "class" /* any clsx ClassValue */]}>button</Button>;