Building a table using MUI 5 and the powerful Grid component from Material UI

For my project, I decided to utilize the Grid component of Material UI v5 to create a global table component. This choice was made due to the difficulties encountered when trying to modify the border and border radius for the table row and footer elements. Styling the table element (or MUI Table component) proved to be challenging.

Currently, I have successfully created a basic table using MUI Grid, but I have two questions:

1- How can I ensure that the height of the grid items in each table row is consistent?

2- Is there a way to add a scroll bar to the container of my grid table when the screen size falls below 500px?

Here is the progress I have made so far:

View Codesandbox

Answer №1

Not to directly answer your questions, but it seems like you are currently exploring a complex issue.

  • If you require a reliable table component, consider using DataGrid.
  • If you need a robust table component with more customization options (such as layout), opt for Table.
  • If you prefer a layout resembling a standard HTML table, utilize the native table and apply CSS accordingly.

The rationale behind my decision is that adjusting borders and border radii for table rows and footers can be problematic and styling the table element itself can be challenging.

It may not be practical for a layout component like this to have individual border radii defined for each row or section. Instead, this functionality can likely be achieved in a different manner.

<td>
  <Card borderRadius={10} />
<td>

Regarding the mention of "problems," you can specify styles at the table cell level - what specific issues are you encountering?

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

Execute with jQuery using Multiple Attribute Selector

I am attempting to input numeric values using a keyboard. My issue is as follows: the keyboard has an "Accept" button, and I have multiple text fields. I want to assign a different action for each text field. I attempted to use multiple attribute selector ...

React - Preventing label click event propagation in a table is proving to be a challenge

In this example, a simple <table> is used with a checkbox inside. Click events are set on the td, tr, and checkbox elements. The goal is to click the checkbox and prevent the event from bubbling up to the td and tr elements. This can be achieved by u ...

The search filter in react material-table is not functioning properly upon initialization

Search functionality is functioning correctly in this code snippet: <MaterialTable columns={[ { title: 'Name', field: 'firstname', type: 'string' } ]} /> Unfortunately, the Search filte ...

How to send parameters to the jQuery delete button click event handler

Here is the jQuery code I am working with: $('#btnDelete').click( function() {//Do the delete here via jquery post}); In my table, each row has a delete button like this: <a id="btnDelete">Delete</a> I need to pass parameters to t ...

How to dynamically change the position of an input field within a form using JavaScript and jQuery

I have a form displayed on my website that looks like this: input a input b input c I am wondering if it is achievable to rearrange the order of inputs using jQuery, like so: input a input c input b However, it is important that the data is still ...

Smart method for repositioning multiple elements on the display

Imagine we have multiple divs displayed on a screen: https://i.stack.imgur.com/jCtOj.png ...and our goal is to move them collectively, either to the left: https://i.stack.imgur.com/KBfXC.png ...or to the right: https://i.stack.imgur.com/c1cUw.png An ...

Difficulty encountered in displaying HTML within a React component

Struggling to display HTML in my React code, whenever I click 'signup' after starting the page, it shows the 'login' view instead. Could there be an issue with how I'm linking everything together? App.js class App extends Compon ...

Rows within distance

There seems to be too much space between the grid rows. I tried adding more photos or adjusting the height of the .image class to 100%, but then the image gets stretched out. The gap between items with classes .description and #gallery is too wide. When ...

Unveiling the method to retrieve XML tag based on the attribute of its parent element

This snippet is a segment of XML code: <?xml version="1.0"?> <menu> <pizzas> <pizza number="0"> <title>Tomato &amp; Cheese</title> <small>550</small> <medium></medium> <large> ...

How to send an email using asp.net and html

This is the form on my index.aspx page. <form role="form" method="post" action="SendMail.aspx"> <div class="form-group"> <input type="text" class="form-control" id="name" name="name" placeholder="Name" required> </div> ...

"Clicking on a hash link will refresh the current page

I have a snippet of code embedded on external websites that loads HTML, CSS, and JavaScript using a <script> tag. Within the code is a JavaScript function that triggers when a specific link is clicked: <a href="#">?</a> If there are Ja ...

Persistent header feature in AdminLTE 3: Easily navigate while scrolling

I am looking to make the elements in the red box on the left side of the page fixed so that as users scroll, they remain at the top of the page. I have attempted to use both the fixed and sticky properties, but neither seem to be working for me. Here is a ...

Redirecting to the homepage of our website automatically

Today I received a new project assignment. The task involves creating a website intro and running it on an HTML page, which I am familiar with how to do. I have successfully completed this part of the project. However, I now need to ensure that once the ...

The element is absent in Type {}, however, it is mandatory in Type '&' and '&' cannot be designated to String Index Type Errors

I have a goal of passing the logged-in user's email address to a 'dict' as a key, fetching its corresponding token value, and using it as a query parameter for an API call. The user's email is retrieved from the user data upon login, sp ...

Intercept Axios Responses - Retrieving API Responses for HTTP Statuses that are not in the 200 range

I've set up a custom Axios instance with interceptors for handling responses. As per the Axios documentation, the success interceptor is triggered for 2xx statuses while the error interceptor handles any other status codes. My goal is to show an error ...

Personalize your BigBlueButton experience with custom HTML 5 client modifications

Does anyone know how to remove the three-dot options menu button in the Big Blue Button HTML 5 client that's installed on Ubuntu? Our setup involves displaying the html5 client inside an iframe, so we need to handle the meeting leave and end functions ...

Unable to display Mapbox within Material UI Dialog

Here is a snippet of code to consider: import React, { useEffect, useState } from 'react'; import { Dialog } from '@material-ui/core'; import mapboxgl from 'mapbox-gl'; export default function UseMapbox() { const classes = ...

Take away the CSS class from an element after reCAPTCHA verification is complete in Next.js

I'm struggling with removing the CSS class btn-disabled from the input button element upon successful verification of a form entry. I have implemented a function called enableForm to remove the btn-disabled CSS class when reCAPTCHA is verified. Howe ...

Adaptive Style Sheets Strategy

The images below depict the concept I am trying to achieve. The first image shows a longer width while the second one represents a shorter width. The red blocks are positioned on the right and left sides, with the yellow block adjusting its width based on ...

Guide on incorporating personalized color palettes into the entire system with Material UI v1

Understanding the v1 theme configuration guide can be quite challenging. In my web app, I have a defined palette with the main primary color set to '#6699CC', which is used throughout the system: const theme = createMuiTheme({ palette: { p ...