diff --git a/docs/pages/api/app-bar.md b/docs/pages/api/app-bar.md index 3a1e998ec352ec..3715b4de2b3102 100644 --- a/docs/pages/api/app-bar.md +++ b/docs/pages/api/app-bar.md @@ -26,7 +26,7 @@ You can learn more about the difference by [reading this guide](/guides/minimizi |:-----|:-----|:--------|:------------| | children | node | | The content of the component. | | classes | object | | Override or extend the styles applied to the component. See [CSS API](#css) below for more details. | -| color | 'default'
| 'inherit'
| 'primary'
| 'secondary'
| 'primary' | The color of the component. It supports those theme colors that make sense for this component. | +| color | 'default'
| 'inherit'
| 'primary'
| 'secondary'
| 'transparent'
| 'primary' | The color of the component. It supports those theme colors that make sense for this component. | | position | 'absolute'
| 'fixed'
| 'relative'
| 'static'
| 'sticky'
| 'fixed' | The positioning type. The behavior of the different options is described [in the MDN web docs](https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Positioning). Note: `sticky` is not universally supported and will fall back to `static` when unavailable. | The `ref` is forwarded to the root element. @@ -49,6 +49,8 @@ Any other props supplied will be provided to the root element ([Paper](/api/pape | colorDefault | .MuiAppBar-colorDefault | Styles applied to the root element if `color="default"`. | colorPrimary | .MuiAppBar-colorPrimary | Styles applied to the root element if `color="primary"`. | colorSecondary | .MuiAppBar-colorSecondary | Styles applied to the root element if `color="secondary"`. +| colorInherit | .MuiAppBar-colorInherit | Styles applied to the root element if `color="inherit"`. +| colorTransparent | .MuiAppBar-colorTransparent | Styles applied to the root element if `color="transparent"`. You can override the style of the component thanks to one of these customization points: diff --git a/packages/material-ui/src/AppBar/AppBar.d.ts b/packages/material-ui/src/AppBar/AppBar.d.ts index edc159b7664e87..f54e32bdc79c71 100644 --- a/packages/material-ui/src/AppBar/AppBar.d.ts +++ b/packages/material-ui/src/AppBar/AppBar.d.ts @@ -5,7 +5,7 @@ export interface AppBarProps extends StandardProps { /** * The color of the component. It supports those theme colors that make sense for this component. */ - color?: PropTypes.Color; + color?: PropTypes.Color | 'transparent'; /** * The positioning type. The behavior of the different options is described * [in the MDN web docs](https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Positioning). diff --git a/packages/material-ui/src/AppBar/AppBar.js b/packages/material-ui/src/AppBar/AppBar.js index fad841549000de..7ac30291ac2bf0 100644 --- a/packages/material-ui/src/AppBar/AppBar.js +++ b/packages/material-ui/src/AppBar/AppBar.js @@ -69,6 +69,15 @@ export const styles = theme => { backgroundColor: theme.palette.secondary.main, color: theme.palette.secondary.contrastText, }, + /* Styles applied to the root element if `color="inherit"`. */ + colorInherit: { + color: 'inherit', + }, + /* Styles applied to the root element if `color="transparent"`. */ + colorTransparent: { + backgroundColor: 'transparent', + color: 'inherit', + }, }; }; @@ -83,8 +92,8 @@ const AppBar = React.forwardRef(function AppBar(props, ref) { className={clsx( classes.root, classes[`position${capitalize(position)}`], + classes[`color${capitalize(color)}`], { - [classes[`color${capitalize(color)}`]]: color !== 'inherit', 'mui-fixed': position === 'fixed', // Useful for the Dialog }, className, @@ -116,7 +125,7 @@ AppBar.propTypes = { /** * The color of the component. It supports those theme colors that make sense for this component. */ - color: PropTypes.oneOf(['default', 'inherit', 'primary', 'secondary']), + color: PropTypes.oneOf(['default', 'inherit', 'primary', 'secondary', 'transparent']), /** * The positioning type. The behavior of the different options is described * [in the MDN web docs](https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Positioning).