-
Notifications
You must be signed in to change notification settings - Fork 832
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How can I change Checkbox color? #1557
Comments
For any advanced theming like this, you'll probably need to take a look at how we implement the theme ourselves: https://github.com/segmentio/evergreen/blob/master/src/themes/default/components/checkbox.js In this case, we don't define any base style (just a Each of the states is represented with a placeholder selector, so you'll probably want to at least override The label is rendered internally and does not read from the theme - but can be overridden with the extra box props that are spread onto the evergreen/src/checkbox/src/Checkbox.js Lines 98 to 106 in 0c36c45
|
@brandongregoryscott thank you very much it worked, how can I change also label color? |
Ah, sorry, I was mistaken. The outer Box is rendered as a evergreen/src/checkbox/src/Checkbox.js Lines 133 to 137 in 0c36c45
It looks like we don't allow you to configure the label styling here. You could achieve a similar styling by making your own wrapper component like this: import { CheckboxProps, Pane, Checkbox, Text, useTheme } from "evergreen-ui";
const CustomLabelCheckbox = (props: CheckboxProps) => {
const { label, ...rest } = props;
const { colors } = useTheme();
return (
<Pane display="flex" flexDirection="row" alignItems="center">
<Checkbox {...rest} />
<Text marginLeft={8} size={300} color={colors.red600}>
{label}
</Text>
</Pane>
);
}; However, you won't get the benefit of the I'm thinking we could make that component a little more flexible by accepting a |
Just use accent-color property in css. For example; <style> input[type=checkbox]{ accent-color : "red"; } </style> |
I have tried to change checkbox color with no luck, this is my code:
how can I change checkbox square color when checked? and the label color?
The text was updated successfully, but these errors were encountered: