You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently using an absolutely positioned sibling as a workaround.
I'm sure a pseudo element could be made to work but it's a little more difficult to style given the color is coming from JavaScript, especially in Tailwind.
Provide a general summary of the feature here
Add a
children
prop to<ColorSwatch>
that can take aReactNode
or a render prop that is passed the swatch color that returns aReactNode
.🤔 Expected Behavior?
With a ReactNode
or with a render prop
😯 Current Behavior
<ColorSwatch>
doesn't render anychildren
.💁 Possible Solution
I think the starting point is to add
children
to the render props here:react-spectrum/packages/react-aria-components/src/ColorSwatch.tsx
Lines 18 to 25 in 93c26d8
I'm not sure what else if anything would be needed.
🔦 Context
I have a swatch that renders some text on top of the selected color in order to demonstrate text contrast, e.g.:
This is currently being done with
<ColorSwatch>
by absolutely positioning the text element on top of the swatch relative to a shared parent.💻 Examples
No response
🧢 Your Company/Team
No response
🕷 Tracking Issue
No response
The text was updated successfully, but these errors were encountered: