Replies: 1 comment
-
|
You can style With plain CSS: /* Remove the default outline */
[data-radix-checkbox-root]:focus-visible {
outline: none;
}
/* Or style it how you want */
[data-radix-checkbox-root]:focus-visible {
outline: 2px solid #4f46e5;
outline-offset: 2px;
}With Tailwind: <Checkbox.Root className="focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 focus-visible:ring-offset-2">
<Checkbox.Indicator>...</Checkbox.Indicator>
</Checkbox.Root>With styled-components / CSS-in-JS: const StyledCheckbox = styled(Checkbox.Root)`
&:focus-visible {
outline: none;
box-shadow: 0 0 0 2px #4f46e5;
}
`;The black outline you are seeing is the browser's default focus style. Radix primitives are intentionally unstyled, so it is up to you to override that default. Just target |
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.
-
CSS has a
:focus-visibleselector. How am I supposed to style a Radix component for this state? For example, the checkbox shown in the documentation shows a black outline when clicked, which I do not want.Beta Was this translation helpful? Give feedback.
All reactions