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

102
Views
¿Cómo cambiar la distancia de los componentes para que no se superpongan?

Me gustaría cambiar la distancia de los componentes (campo de texto y botón) para que no se superpongan, pero hay un espacio entre ellos y no sé cómo hacerlo.

Me gustaría agregar al menos 1-2 espacios entre el texto del campo y el botón

Así es como se ve:

imagen

código:

 import * as React from 'react'; import TextField from '@mui/material/TextField'; import { Box, Paper, Button} from '@mui/material'; export default function Student() { const paperStyle={padding:'50px 20px', width:600, margin:"20px auto"} const[name, setName]=React.useState('') const[address, setAddress]=React.useState('') return ( <Box component="form" sx={{ '& > :not(style)': { m: 1, }, }} noValidate autoComplete="off" > <Paper elevation={3} style={paperStyle}> <h1 style={{color:"blue"}}><u>text</u></h1> <TextField id="outlined-basic" label="Name" variant="outlined" fullWidth value={name} onChange={(e)=>setName(e.target.value)} /> <TextField id="outlined-basic" label="Address" variant="outlined" fullWidth value={address} onChange={(e)=>setAddress(e.target.value)} /> <Button variant="outlined">Primary</Button> {name} {address} </Paper> </Box> ); }
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

ese accesorio sx en su Box agregaría el margen entre los elementos:

 sx={{ "& > :not(style)": { m: 1 } }}

pero el > lo limita a solo formar elementos directamente dentro del Box , pero debido a que agregó el Paper el selector css ya no lo detecta.

lo más fácil sería simplemente más ese apoyo sx de la Box al Paper

Aquí hay un ejemplo práctico:https://codesandbox.io/s/romantic-rubin-80o3d2?file=/src/App.js

about 4 years ago · Juan Pablo Isaza Report

0

¿Quizás style={{ bottomGap: 10 }} para ambos componentes de TextField?

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!