Comments (4)
Hi @kripod,
Thanks for this observation. The children prop of Radio
or Checkbox
is optional. If you need to gain control over the styling of the labels, ignore it and compose the component this way.
<Flex as="label">
<Radio key={choice} value={choice} color="green" />
<Box ml={2} color="red.500">{choice}</Box>
</Flex>
Note that applying the color
prop for primitives other than Radio
or Checkbox
should be accessed with the dot notation. The Box
you have should have a prop of red.X
, where X
is 50-900.
I've noted your feedback on the color
though. I'll test it out.
Thanks again.
from chakra-ui.
I appreciate your detailed feedback. However, the outlined approach comes with a lot of boilerplate and might be hard to remember or reason about, especially for beginners. I would still suggest using a separate iconColor
prop, which could be modified on its own, especially with #49 taken into consideration:
<Radio
value="foo"
color="red"
iconColor="black"
_checked={{ iconColor: 'green' }}
>
This piece of text should be red, but the icon should be
black by default or green when hovered
</Radio>
from chakra-ui.
I completely understand your perspective @kripod . Thanks for the feedback, I'll try it out.
from chakra-ui.
Hi @kripod ,
I'm closing to this issue because there are other ways to solve this.
Option 1 (recommended)
const choice = 'Answer to a quiz question';
<Radio key={choice} value={choice} color="green">
<Box color="red.500">{choice}</Box>
</Radio>
Option 2
<Flex as="label">
<Radio key={choice} value={choice} color="green" />
<Box ml={2} color="red.500">{choice}</Box>
</Flex>
We've looked into this suggestion:
<Radio
value="foo"
color="red"
iconColor="black"
_checked={{ iconColor: 'green' }}
>
This piece of text should be red, but the icon should be
black by default or green when hovered
</Radio>
We think might not be possible at the moment because the iconColor
isn't a style prop and there's more we need to do to support that.
Kindly use the suggested options above.
Thanks again.
from chakra-ui.
Related Issues (20)
- Pagination component (willing to work on a PR)
- Fix references to old documentation repo HOT 3
- `Theme Source` link on modal doc page is broken HOT 2
- Tooltip still open after clicking an external Link HOT 1
- Sidebar Icon Button too close to each other - Visible Overlapping HOT 2
- ‼️ The docs are broken ‼️ HOT 2
- Tooltip docs broken HOT 1
- "ReferenceError: CircularProgress is not defined" in CircularProgress docs HOT 1
- "Application error: a client-side exception has occurred" in docs for tooltip page HOT 1
- "ReferenceError: Tab is not defined" errors on Tabs docs HOT 1
- "Error: Minified React error #130" on Avatar docs page HOT 1
- "ReferenceError: AccordionPanel is not defined" on the Accordion docs page HOT 1
- Multiple Errors on the Popover docs page HOT 1
- theming.types.d.ts generated by CLI not being loaded? HOT 2
- Progress is not a clickable element when used with LinkOverlay
- (proposal) Add _unchecked prop for Switch and Checkbox
- `focusBorderColor` does not work with `semanticTokens`
- " HOT 1
- Scrollbar not following activeIndex on Menu (when have fixed Height)
- Custom Tab - Disabled state doesn't work HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chakra-ui.