Loading...
Loading...
Enforces classNames package usage patterns and Tailwind CSS class ordering conventions in React components. Use this skill whenever writing or reviewing component className props, applying Tailwind classes, using the classnames package, organizing breakpoint-specific styles, writing conditional class expressions, or when the user asks about CSS class ordering, mobile-first responsive patterns, or how to handle className props in components.
npx skill4agent add ilya-valasiuk/agent-skills organizing-classnamesclassNames'classnames'classNameclassName?: stringclassNameclassName={classNames('default-classes', className)}base (no prefix) → xs: → s: → sm: → md: → m: → lg: → xl: → 2xl:Check the project'sfor the actual breakpoint names — they may differ.tailwind.config
classNamesclassName={classNames(
'base-style-1 base-style-2',
'xs:xs-style-1 xs:xs-style-2',
'sm:sm-style-1 sm:sm-style-2',
'md:md-style-1 md:md-style-2',
'lg:lg-style-1 lg:lg-style-2',
'xl:xl-style-1 xl:xl-style-2',
'2xl:2xl-style-1 2xl:2xl-style-2'
)}classNametype Props = {
size?: ButtonSize;
variant?: ButtonVariant;
className?: string;
};
export const Button: React.FC<Props> = ({
children,
size = ButtonSize.MEDIUM,
variant = ButtonVariant.PRIMARY,
className,
...props
}) => (
<button
className={classNames(
"block rounded-lg text-center transition",
"disabled:opacity-50",
{ "px-3 py-2 text-sm-medium": size === ButtonSize.SMALL },
{ "px-4 py-3 text-md-medium": size === ButtonSize.MEDIUM },
{
"bg-orange-500 text-white hover:bg-orange-700":
variant === ButtonVariant.PRIMARY,
},
{
"outline outline-gray-500 hover:text-orange-500":
variant === ButtonVariant.SECONDARY,
},
{ "pointer-events-none": Boolean(props?.disabled) },
className,
)}
type="button"
{...props}
>
{children}
</button>
);classNametype Props = {
title: ReactNode;
children: ReactNode;
className?: string;
headerClassName?: string;
contentClassName?: string;
};
export const Card: React.FC<Props> = ({
title,
children,
className,
headerClassName,
contentClassName,
}) => (
<div className={classNames("rounded-lg border", className)}>
<div className={classNames("border-b p-4", headerClassName)}>{title}</div>
<div className={classNames("p-4", contentClassName)}>{children}</div>
</div>
);const Buttons = () => {
const buttonClassName = classNames(
"flex w-full shrink-0 items-center justify-center transition-colors",
"lg:cursor-pointer",
);
return (
<div className="flex flex-col gap-3">
<button className={classNames(buttonClassName, "button-primary")}>
{/* Content */}
</button>
<button className={classNames(buttonClassName, "button-secondary")}>
{/* Content */}
</button>
</div>
);
};classNames'classnames'className?: stringclassName