[Question] How to change the `barColorPrimary` style dynamically for `LinearProgress`?
See original GitHub issue- I have searched the issues of this repository and believe that this is not a duplicate.
Question
How am I able to change the bar color of LinearProgress
component dynamically?
For example, I would like the color code to be a prop of my component, and in my component, I would like to set the color of the linear progress bar to be that color.
class MyComponent extends React.Component {
render() {
const { barColor } = this.props; // the color code, e.g, #efefef
return (
<LinearProgress
variant="determinate"
value={progressBar.quantity}
classes={{
barColorPrimary: <how am I able to associate the barColor here?>
}}
/>
);
}
}
Your Environment
Tech | Version |
---|---|
Material-UI | beta 44 |
React | 16.2.0 |
Issue Analytics
- State:
- Created 5 years ago
- Reactions:5
- Comments:9 (9 by maintainers)
Top Results From Across the Web
[Question] How to change the barColorPrimary style ... - GitHub
How am I able to change the bar color of LinearProgress component dynamically? For example, I would like the color code to be...
Read more >color change for the loading bar component of material ui
It is because you set the CSS is not correctly, const styles = { root: { flexGrow: ... First set a className to...
Read more >Change the html progress bar color dynamically bas...
Hi Team, I am using a html text control to make a progress bar and the text is as below.. Everything works fine...
Read more >LinearProgress API - Material UI - MUI
API reference docs for the React LinearProgress component. Learn about the props, CSS, and other APIs of this exported module.
Read more >React MUI LinearProgress API - GeeksforGeeks
barColorPrimary (.MuiLinearProgress-barColorPrimary): It is the style applied to the bar elements if color is set to primary and bar2 if a ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The new documentation section is live: https://material-ui.com/customization/overrides/#2-dynamic-variation-for-a-one-time-situation. Right now, people have to either use
CSS variables
orTheme nesting
.I already use
withTheme()