Replies: 1 comment
-
This is what i ended up with, but it doesnt seems the Chakra way: const AIButtonWithDefaultStyles = chakra(Button, {
baseStyle: {
color: 'white',
bg: 'black',
_hover: {
color: 'whiteAlpha.800',
bg: 'black',
_disabled: { bg: '#8B8B8A' },
},
_active: { color: 'whiteAlpha.900' },
_disabled: { bg: '#8B8B8A' },
},
});
const variantStyles = {
outline: {
bg: 'transparent',
color: 'black',
_hover: { bg: 'blackAlpha.100', _disabled: { bg: 'blackAlpha.100' } },
_active: { bg: 'blackAlpha.300' },
_disabled: { bg: 'blackAlpha.100' },
},
};
export const AIButton = ({ children, variant, ...props }: PropsWithChildren<AIButtonProps>) => {
const variantStyle = variantStyles[variant as keyof typeof variantStyles] || {};
return (
<AIButtonWithDefaultStyles {...variantStyle} {...props} >
{children}
</AIButtonWithDefaultStyles>
);
}; |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
How can i define a component with different variants without contributing it to the global theme?
Something like:
but i want to use it only in that Button. What is the proper way to do it? i want that
rounded
andsmooth
will add properties to thebaseStyle
Beta Was this translation helpful? Give feedback.
All reactions