ReactJS Material UI sticky footer not working

Viewed 6887

How do I get sticky footer with ReactJS using Material UI. I tried this but not sticking to the bottom.

export default function Footer() {
    return (
        <footer style={{color: "gray"}}>
            <center>Copyright ...</center>
        </footer>
    )
}

Looks like there is no native support in materialui. Will be good if the solution does not use boostrap.

3 Answers

You should use position fixed for footer:

<footer style={{color: "gray", position: "fixed", bottom: 0}}>
  <center>Copyright ...</center>
</footer>

This works for you

export default function Footer() {
    return (
        <footer className="sticky bottom-0">
            <center>Copyright ...</center>
        </footer>
    )
}

You can make your footer sticky with something like this

export default function Footer() {return (
    <footer style={{color: "gray", position: "fixed", bottom: 0}}>
        <center>Copyright ...</center>
    </footer>
)}
Related