Skip to content

Instantly share code, notes, and snippets.

@yinkakun
Last active October 19, 2023 08:51
Show Gist options
  • Save yinkakun/9e031924f6663b5cfc9e7bac5857b873 to your computer and use it in GitHub Desktop.
Save yinkakun/9e031924f6663b5cfc9e7bac5857b873 to your computer and use it in GitHub Desktop.
import { ClassValue, clsx } from 'clsx';
import { twMerge } from 'tailwind-merge';
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}
type ButtonProps = React.ComponentProps<'button'>;
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
({ className, children, ...props }, forwardedRef) => {
return (
<button
className={cn('', className)}
{...props}
ref={forwardedRef}
>
{children}
</button>
);
},
);
Button.displayName = 'Button';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment