List of exports available from react-twc
package.
Builds a twc
component.
import { twc } from "react-twc";
const Title = twc.h2`font-bold`;
Create a custom instance of twc
.
import { createTwc } from "react-twc";
import { twMerge } from "tailwind-merge";
const twx = createTwc({
compose: twMerge,
shouldForwardProp: (prop) => prop[0] !== "_",
});
compose
: The compose function to use. Defaults toclsx
.shouldForwardProp
: The function to use to determine if a prop should be forwarded to the underlying component. Defaults toprop => prop[0] !== "$"
.
Concatenates class names (an alias of clsx
).
import { cx } from "react-twc";
const className = cx(classes);
Returns props accepted by a twc
component. Similar to React.ComponentProps<"button">
with asChild
prop and className
type from clsx
.
import type { TwcComponentProps } from "react-twc";
type ButtonProps = TwcComponentProps<"button">;