Replies: 1 comment
-
Thanks for this! I agree it would be ideal to have them both work. Writing import { classed as cn } from "@tw-classed/core";
import { classed } from "@tw-classed/react"; might feel a bit cumbersome. I don't think the React function should change however. Classed is specifically referring to applying classes to a component. This has been the case in many usage guides writing custom Adding the Syntax would be as follows import { classed, clc } from "@tw-classed/react"; // Example 1
import { classed, core } from "@tw-classed/react"; // Example 2
// Example 3 direct property ( Bundle size will increase with 200-300b here )
import { classed } from "@tw-classed/react";
const button = classed.core("bg-blue-500", {...variants}, "more classes"); I certainly prefer the `classed.core´ method, but anything goes. Feel free to come up with any names :) |
Beta Was this translation helpful? Give feedback.
-
Personally I would still find value from a function that produces only a classname, and not a component, even within a React context.
The issue with the current setup is bad DX when importing
classed
as both functions exposed by @tw-classed/react and @tw-classed/core are named the sameSome alternative solutions could be
classed
function in the react package tocomponent
or something similarcomponentising
feature as an overload on the core function instead, perhaps based on the value of the first argument.Opening this issue as a discussion. I like the direction of this library. Reminds me of cva
Beta Was this translation helpful? Give feedback.
All reactions