Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

452
Views
¿Cómo puedo centrar verticalmente InputLabel dentro del elemento MUI Grid?

Quiero centrar verticalmente InputLabel dentro del elemento MUI Grid . Intenté lo siguiente:

 import { FormControl, Grid, Input, InputLabel, TextField } from "@mui/material"; export default function App() { return ( <Grid container> <Grid item xs={2}> <InputLabel htmlFor="name-input">First Name: </InputLabel> </Grid> <Grid item xs={10}> <TextField size="small"></TextField> </Grid> <Grid item xs={2}> <InputLabel sx={{ verticalAlign: "middle" }} htmlFor="name-input"> First Name:{" "} </InputLabel> </Grid> <Grid item xs={10}> <TextField size="small"></TextField> </Grid> </Grid> ); }

Pero no se alinea verticalmente:

ingrese la descripción de la imagen aquí

enlace de Codesandbox

Tenga en cuenta que configurar sx={{ verticalAlign: "middle" }} en la segunda InputLabel tampoco ayuda.

¿Cómo se debería (posiblemente idealmente) centrar verticalmente InputLabel (o cualquier otro control) dentro del elemento Grid ?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

si agrego

 display: flex; align-items: center;

a los elementos de cuadrícula divs funciona.

Encuentro esto un explicador útil de flexbox: https://css-tricks.com/snippets/css/a-guide-to-flexbox/

Lo he agregado a su sandbox aquí: https://codesandbox.io/s/peaceful-pascal-3rpokb?file=/src/App.js

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!