Troubleshooting Material-UI Menus

I need the menu to adjust its height dynamically as the content of the page increases vertically. Even though I have applied "height:100%" in the styles, it doesn't seem to work.

Can anyone assist with this issue?

Here is the code snippet:

import React, { Component } from 'react';
import Menu from 'material-ui/Menu';
import MenuItem from 'material-ui/MenuItem';
import './mystyle.css';

const mainmenu = {
 width: '180px',
 height: '100%',
};

class MenuView extends Component {
  render() {
    return (
        <div className="dash-menuview">
           <Menu style={mainmenu} className="mydashboard">
             <MenuItem primaryText="My Name" style={{color:'white'}} href="#/name" onClick={handlers.changeURL}/>
             <MenuItem primaryText="Personal Information" style={{color:'white'}} href="#/information" onClick={handlers.changeURL}/>
             <MenuItem primaryText="My Address" style={{color:'white'}} href="#/current" onClick={handlers.changeURL}/>
             <MenuItem primaryText="My Files" style={{color:'white'}} href="#/files" onClick={handlers.logout}/>  
           </Menu>
        </div>
    );
  }
}
export default MenuView;

mystyle.css

.dash-menuview {
   margin-left: -8.8%;
}
.mydashboard a {
  color: #FFFFFF;
  text-decoration: none;
}

Answer №1

If you want to set the height of an element to 100% of the viewport height, you can use the code snippet below as a reference:

.dash-menuview {
   margin-left: 0;
   background :#444;
   height: 100vh;
}
.mydashboard a {
  color: #FFFFFF;
  text-decoration: none;
  display: block;
}
<div class="dash-menuview">
    <Menu class="mydashboard">
        <a href="#">My Name</a>
        <a href="#">Personal Information</a>
        <a href="#">My Address</a>
        <a href="#">My Files</a>  
    </Menu>
</div>

For further assistance, you can also visit this Fiddle link. I hope this information proves useful to you.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Inconsistency in Firebase data updates

Hey there, my code snippet below is responsible for capturing latitude and longitude values through a drag-and-drop marker. Although the latitude and longitude are continuously updated in the console when I log them, the same doesn't seem to happen wh ...

Unusual behavior observed in AngularJs local variables

This code snippet is from the controller: cat1=[]; $.getJSON('categories/1/', function(data) { cat1 = data; //this returns a JSON object }); //cat2..4 are also JSONs $scope.pictures=[cat1,cat2,cat3,cat4,cat5]; The issue here seems to be th ...

Best Practices for Iterating over Nested Objects and Arrays Using ng-repeat

I've been trying to use Angular's ng-repeat, but nothing seems to work for me. I'm attempting to loop through companies.users and display all the first names. Any assistance would be greatly appreciated! Thank you! <div ng-app="app" ng-c ...

Creating a personalized tooltip hook: A step-by-step guide

Recently, I created a navbar component using JSX. However, when attempting to integrate tooltips into this component, I found myself having to manually insert tooltip code with the title prop for each instance. For illustration purposes, here is an exampl ...

Encountering an issue with resolving 'create-react-class'

I have some files with hobbies listed in Data.js. I am attempting to add these hobbies and display them in a list format within my App.js file. However, I keep encountering an error stating that the create-react-class module cannot be found. Does anyone k ...

No matter how hard I try, the async function within the React Component keeps returning 'Promise {<pending>}' consistently

Currently, I'm facing an issue where running an asynchronous function inside a functional component in React (NextJS) results in the function returning a pending promise: Promise {<pending>}. Oddly enough, fetching data from a dummy API works pe ...

After the component has been initialized for the second time, the elementId is found to be null

When working with a component that involves drawing a canvas chart, I encountered an issue. Upon initializing the component for the first time, everything works fine. However, if I navigate away from the component and return to it later, document.getElemen ...

What is the reason behind Azure Identity's choice of Browserflow over nodeflow for integration in my Next.js application?

Embarking on my inaugural project with Next.js, I find myself in unfamiliar territory. Rather than joining existing projects, I am constructing apps from scratch, encountering a challenge with Azure Identity along the way. Upon delving into the node module ...

Unable to trigger onClick event

The button I have with the id "jump-button" is not functioning at all. When clicked, nothing happens. I have added an alert(); to the onclick attribute to test if the button is working. However, the other two buttons (next and prev) are working perfectly ...

Is there a way to resolve the Helvetica issue in NextJS when using pdfkit-Table?

Having some trouble generating a PDF file as I keep encountering the following error message: ⨯ Error: ENOENT: no such file or directory, open 'C:\Users\HECTOR\Documents.next\server\vendor-chunks/data/Helvetica.afm' err ...

Center position of modal dialog box is not fixed in material-ui as it sets the maxWidth

My challenge is to adjust the max-width of the Dialog component in material-ui. Whenever I set the maximum width, the modal loses its center positioning. To showcase this issue, I've prepared a basic example: //npm install material-ui import React fr ...

Having trouble incorporating an API module into a nested component in Vue

I have encountered a perplexing issue when attempting to import an API module into a nested component within a Vue application. After simplifying the problem as much as possible, I created a codesandbox example to demonstrate it. The problem arises when ...

Dealing with Request Disconnection in a Node.js and Express Application

I have a node/express application and I am looking for a way to detect unexpected interruptions in the connection. I have attempted using the following code: req.on('close', function () { //this handles browser/tab closure scenarios }) Howev ...

Why does LESS keep prompting me with missing elements?

I am currently working on my first project using Less and have been following a tutorial closely. However, when I try to compile with lessc, I encounter the following error: ParseError: Unrecognised input. Possibly missing something in C:\Path\t ...

What does the client perceive or not perceive? Node.js, JavaScript, MySQL

For a university project, I am tasked with creating a web application that is compatible with both desktop browsers and mobile devices. The technologies I will be using include HTML, CSS, JavaScript, Node.js, and MySQL. I have recently familiarized myself ...

Perform an Ajax POST request to a specific URL and then automatically redirect to that same

I am currently in the process of developing a web application that allows users to create markers on a Leaflet map. The marker details are then saved in a Django backend system. My objective is to direct the user to a detailed page where they can input mar ...

React - State array removing the last element instead of the element at the specified index

In my current setup, I have an array state that is populated with objects referred to as items: const [items, setItems] = useState([{name: "", toppings: []}]) However, when attempting to remove a specific index using this function: const removeItem ...

When a value is deleted from an input in jQuery, all other changes become void

I am experiencing an issue with Javascript where even after deleting or changing the value of a field, jQuery effects still persist. Is there a way to reset all changes made when the input value is deleted? For example, you can visit , type 6 in and then ...

The movement of particles in tsparticles experiences interruptions when built in React, causing defects in their motion or noticeable stutter and lag

The performance is flawless in development mode with npm run start, but once deployed and running the production build (npm run build), there seems to be a disturbance in particle movement or a drastic decrease in speed. Despite experimenting with all ava ...

What are the best situations to utilize bootstrap and when should you avoid it?

When it comes to web development, there is often a debate on whether to use Bootstrap or custom CSS for designing a website. For my school project, I am tasked with creating a homepage and contact page using Bootstrap primarily. However, we are also requir ...