I created a custom button component using Tailwind CSS. The goal is to be able to specify a different `className` when calling the component, however, it currently does not override the default styling.
const styles = {
base: 'rounded-3xl px-6 py-2',
disabled: '',
variant: {
solid: 'bg-blue-700 text-white hover:bg-opacity-95',
outline: 'border border-blue-800 text-blue-900',
},
}
const MyButton = ({
children,
type = 'button',
className,
variant = 'solid',
disabled = false,
onClick,
...props
}: ButtonType) => {
return (
<button
disabled={disabled}
type={type}
onClick={onClick}
className={cx(styles.base, styles.variant[variant], className)}
{...props}>
{children}
</button>
)
}
// Example of how to use the component
<MyButton className='px-4 py-0'/>