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

Typography does not support color "success" #29564

Closed
cleverocheck opened this issue Nov 7, 2021 · 8 comments · May be fixed by #34444
Closed

Typography does not support color "success" #29564

cleverocheck opened this issue Nov 7, 2021 · 8 comments · May be fixed by #34444
Labels
component: Typography The React component. package: system Specific to @mui/system support: Stack Overflow Please ask the community on Stack Overflow

Comments

@cleverocheck
Copy link

General summary
I would like to be able to set the color props for the Typography element to "success", this code does not color the text color
Current Behavior 😯
The Typography component does not have a color props with the "success" value
Expected Behavior 🤔
I would like to be able to set the color props to "success" and for this to work correctly
Steps to Reproduce 🕹

  1. Create CRA with Typography with color = "success" props

Sandbox issue here
Context 🔦
I want to get the "success" text color of Typography in a short way without creating unnecessary entities
My Environment 🌎

  System:
    OS: Linux 5.4 Linux Mint 20.1 (Ulyssa)
  Binaries:
    Node: 14.18.0 - /usr/bin/node
    Yarn: 1.22.10 - /usr/bin/yarn
    npm: 6.14.15 - /usr/bin/npm
  Browsers:
    Chrome: 94.0.4606.81
    Firefox: 93.0
@cleverocheck cleverocheck added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Nov 7, 2021
@mnajdova
Copy link
Member

mnajdova commented Nov 8, 2021

You can use any color in the theme using the system syntax. For example:
<Typography color="success.main" /> - https://codesandbox.io/s/black-wave-vj8xo Take a look at https://mui.com/system/palette/#color

@mnajdova mnajdova added component: Typography The React component. package: system Specific to @mui/system support: Stack Overflow Please ask the community on Stack Overflow and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Nov 8, 2021
@siriwatknp
Copy link
Member

siriwatknp commented Nov 8, 2021

I am closing this one because it is not a bug (we don't have any docs that mention about <Typography color="success" />)

@cleverocheck
Copy link
Author

Yes, is not a bug, I just don't know about this, thank you for help my

@RemyMachado
Copy link

RemyMachado commented Jan 21, 2022

It's a bit tricky. primary & secondary works without .main, but the other colors in the palette don't.

@cleverocheck
Copy link
Author

@RemyMachado I also think that this is not completely logical, but it still works, which means corrections are optional)

@dwanderton
Copy link

+1 for the non-essential improvement

It's a bit tricky. primary & secondary works without .main, but the other colors in the palette don't.
<Typography color="error" /> works without .main also. A default to .main may be desirable for info, warning, success, error. The expectation may come from the implementation of colors from the Bootstrap framework.

@paulintrognon
Copy link

It is inconsistent with the icons, which has got me very frustrated today. I thought I wasn't using the API right, it got me wasting time experimenting with the MuiTheme before I figured out that Typography and Icons behave differently:

  • <Circle color="success" /> works ✔️
  • <Circle color="success.main" /> fails ❌
  • <Typography color="success" /> fails ❌
  • <Typography color="success.main" /> works ✔️

So while I agree it is non essential, it is kinda annoying.

@emlai
Copy link
Contributor

emlai commented Sep 23, 2022

I made a PR to fix this: #34444

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: Typography The React component. package: system Specific to @mui/system support: Stack Overflow Please ask the community on Stack Overflow
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants