Focus Input for the wrapper? #5562
-
Hi! How can I add a focus state to the wrapper of the Input react-aria-components? function MyTextField(
{ label, description, errorMessage, ...props }
) {
return (
<TextField {...props}>
<Label>{label}</Label>
<div className="wrapper" data-focused='?????' data-focus-visible='????'>
<Input />
</div>
{description && <Text slot="description">{description}</Text>}
<FieldError>{errorMessage}</FieldError>
</TextField>
);
} |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
You can use the data attributes already on the TextField, no need to add new ones. Then you can just target elements inside like usual. You can check out these sections in the docs for more info https://react-spectrum.adobe.com/react-aria/styling.html#states and https://react-spectrum.adobe.com/react-aria/TextField.html#styling You can also check out the css for any of the examples just below the example. |
Beta Was this translation helpful? Give feedback.
-
How can I add a |
Beta Was this translation helpful? Give feedback.
You can use the data attributes already on the TextField, no need to add new ones. Then you can just target elements inside like usual.
You can check out these sections in the docs for more info https://react-spectrum.adobe.com/react-aria/styling.html#states and https://react-spectrum.adobe.com/react-aria/TextField.html#styling
You can also check out the css for any of the examples just below the example.