AppBar offset component when it's fixed
See original GitHub issueOn material design react components repo they have a component that helps when the top bar is fixed:
Use the
<TopAppBarFixedAdjust />component to give your content top-padding, so it isn’t hidden on page render.
I’ve made one based on material UI that helps, so you could integrate it.
import React from "react";
import { makeStyles } from "@material-ui/styles";
const useStyles = makeStyles(theme => ({
offset: {
...theme.mixins.toolbar,
flexGrow: 1
}
}))
export default function AppBarOffset() {
const classes = useStyles();
return <div className={classes.offset} />;
}
Use as:
<AppBar position="fixed" />
<AppBarOffset />
- This is not a v0.x issue.
- I have searched the issues of this repository and believe that this is not a duplicate.
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
AppBar offset component when it's fixed · Issue #16844 - GitHub
When the appbar is fixed, you always need this offset, so the content initially doesn't get under the bar. In material UI website...
Read more >Content beneath fixed AppBar - Stack Overflow
And I want the mui.Paper content appear beneath the AppBar, and not hidden by it. Is there a component I'm missing somewhere?
Read more >App Bar React component - Material UI - MUI
When you render the app bar position fixed, the dimension of the element doesn't impact the rest of the page. This can cause...
Read more >App Bar - Demos - react-md
#Fixed with Offset ... App bars are generally great for using in your main layout, so there is also the ability to fix...
Read more >Material UI AppBar - React Navbar Examples
This seems to be why using the Toolbar component as the first component works, because it is offset by 8px, so the start...
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 Free
Top 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

What’s wrong with the Toolbar component?
https://codesandbox.io/s/material-demo-bnlpz
@adeelibr Yes, I think that it would be great to document the placement issue. For instance, I have seen @jlengstorf hit by this problem in a recent video.