Skip to content
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

[joy-ui][Radio] Can't use a checked icon/unchecked icon when setting a background color #42017

Open
rsslldnphy opened this issue Apr 24, 2024 · 1 comment
Assignees
Labels
component: radio This is the name of the generic UI component, not the React module! package: joy-ui Specific to @mui/joy status: waiting for maintainer These issues haven't been looked at yet by a maintainer

Comments

@rsslldnphy
Copy link

rsslldnphy commented Apr 24, 2024

Steps to reproduce

Link to live example: (required)

Steps:

  1. Create a radio group that contains radios with disableIcon set and slotProps that change the background color of the action component when the radio is checked. e.g. This example from the docs
  2. See that it's possible to select the different options, the background color changes, and the label text is still visible.
  3. Remove the disableIcon prop and pass a checkedIcon and/or uncheckedIcon prop with a random icon from @mui/icons-material.
  4. See that the background color of a selected radio hides the icon and label.

Current behavior

The label and icon are hidden when the option is selected.

demo.mov

Expected behavior

The label and icon should remain visible when the option is selected.

Context

Create a radio button group with options that change background color when selected and include icons.

Your environment

npx @mui/envinfo
System:
    OS: macOS 14.4.1
  Binaries:
    Node: 21.7.3 - ~/.asdf/installs/nodejs/21.7.3/bin/node
    npm: 10.5.0 - ~/.asdf/plugins/nodejs/shims/npm
    pnpm: 9.0.1 - /opt/homebrew/bin/pnpm
  Browsers:
    Chrome: 124.0.6367.62
    Edge: Not Found
    Safari: 17.4.1
  npmPackages:
    @emotion/react: ^11.11.4 => 11.11.4 
    @emotion/styled: ^11.11.5 => 11.11.5 
    @mui/joy: 5.0.0-beta.36 => 5.0.0-beta.36 
    @mui/material: ^5.15.15 => 5.15.15 
    @types/react: ^18.2.79 => 18.2.79 
    react: ^18.2.0 => 18.2.0 
    react-dom: ^18.2.0 => 18.2.0 
    typescript: ^5.4.5 => 5.4.5 

Tested in Chrome, Safari, and Firefox

Search keywords: radio background color icon

@rsslldnphy rsslldnphy added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Apr 24, 2024
@rsslldnphy rsslldnphy changed the title Radio - cannot use checkedItem/uncheckedIcon when setting radio background color JoyUI Radio - cannot use checkedItem/uncheckedIcon when setting radio background color Apr 24, 2024
@rsslldnphy rsslldnphy changed the title JoyUI Radio - cannot use checkedItem/uncheckedIcon when setting radio background color JoyUI Radio - cannot use checkedIcon/uncheckedIcon when setting radio background color Apr 24, 2024
@rsslldnphy
Copy link
Author

Just to note, I'm trying to create an uncontrolled component so I am unable (as far as I cant tell) to do anything programmatically based on the inputs value (unless I guess I use a ref?)

@zannager zannager added component: radio This is the name of the generic UI component, not the React module! package: joy-ui Specific to @mui/joy labels Apr 24, 2024
@DiegoAndai DiegoAndai assigned siriwatknp and unassigned DiegoAndai Apr 24, 2024
@danilo-leal danilo-leal changed the title JoyUI Radio - cannot use checkedIcon/uncheckedIcon when setting radio background color [joy-ui][Radio] Can't use a checked icon/unchecked icon when setting a background color Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: radio This is the name of the generic UI component, not the React module! package: joy-ui Specific to @mui/joy status: waiting for maintainer These issues haven't been looked at yet by a maintainer
Projects
None yet
Development

No branches or pull requests

4 participants