Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I change the Material UI Toolbar height?

Tags:

material-ui

I am new to React and Material UI. I am struggling with how much vertical space the components take up. One thing I would like to do is decrease the height of the toolbar.

I have tried specifying the style:

<Toolbar style={{ height: '36px' }}>

I have also tried doing it this way:

const styles = {
  root: {
    height: 36,
  }
};
<Toolbar className={classes.root} >

but neither works. Is there a different way to do this?

like image 285
sweetpea Avatar asked Mar 25 '19 18:03

sweetpea


People also ask

What is Toolbar in material UI?

The Toolbar is a flex container, allowing flex item properites to be used to lay out the children. classes. object. Override or extend the styles applied to the component.

How do I change the color of my material UI app bar?

You will need to customise the Material theme that comes with it. But if you want this AppBar in a different color without touching the existing theme, you can do that by providing the style prop and add the backgroundColor property to say, pink and it turned the color to pink.

How do I add an image to my material UI toolbar?

Just add a closing tag to your Appbar element (remove the self closing tag) and put the image inside.


1 Answers

You need to change the min-height to adjust the height, as min-height is specified in material-ui.css as 64px.

const styles = {
  customizeToolbar: {
    minHeight: 36
  }
};

<Toolbar className={classes.customizeToolbar} >

Hope this will help you.

like image 106
Shiladitya Avatar answered Oct 05 '22 04:10

Shiladitya