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

[Fab] Floating action buttion doesn't support colors #30665

Closed
2 tasks done
mmacu opened this issue Jan 17, 2022 · 3 comments · Fixed by #30846
Closed
2 tasks done

[Fab] Floating action buttion doesn't support colors #30665

mmacu opened this issue Jan 17, 2022 · 3 comments · Fixed by #30846
Labels
component: Fab The React component. design: material This is about Material Design, please involve a visual or UX designer in the process new feature New feature or request

Comments

@mmacu
Copy link
Contributor

mmacu commented Jan 17, 2022

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

Fab component doesn't support any color other than primary or secondary. This is inconsistent with behaviour of other components like Button for example.

image

This is where the issue lies:

https://github.com/mui-org/material-ui/blob/master/packages/mui-material/src/Fab/Fab.js#L113-L136

Instead of theme.palette.primary.main there should be theme.palette[ownerState.color].main etc. (some conditions around need to be changed as well here)

Expected behavior 🤔

color property of Fab should be consistent with that of other components (like Button and many other) and accept all defined colors.

Steps to reproduce 🕹

https://codesandbox.io/s/customcolor-material-demo-forked-l5fml?file=/demo.js

Context 🔦

No response

Your environment 🌎

`npx @mui/envinfo`
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.
@mmacu mmacu added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Jan 17, 2022
@mnajdova mnajdova added component: Fab The React component. new feature New feature or request design: material This is about Material Design, please involve a visual or UX designer in the process and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jan 24, 2022
@alisasanib
Copy link
Contributor

I would like to work on this issue. I think it is a good idea to include other types for the color such as success, error, warning etc. for the Fab component, exactly like the Button component.

@danilo-leal
Copy link
Contributor

It makes total sense to me! However, wouldn't this be a breaking change? 🤔

@alisasanib
Copy link
Contributor

I don't think it would be a breaking change. To achieve this, we need to change some conditions to include other values for the color prop only in the Fab component. Changes will not be significant and they'll not affect other components

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: Fab The React component. design: material This is about Material Design, please involve a visual or UX designer in the process new feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants