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

122
Views
¿Cómo cambio el estilo de un accesorio en <TextField>?

Estoy representando <TextField> dos veces usando mi componente DatePicker.js definido. Entonces, siempre que el usuario haga clic en <CalendarIcon> que está dentro de <TextField> , se abrirá un pequeño calendario. Quiero diseñar la etiqueta en <TextField> de una manera específica. Actualmente, así es como se ve.

ingrese la descripción de la imagen aquí
Puede ver que la etiqueta 'Para' del segundo <TextField> está visible. Debe venir detrás del calendario y no debe aparecer.

 class DatePickerInput extends React.Component { render() { const { classes, label, selectedDate } = this.props; return (<TextField fullWidth variant="filled" label={label} onClick={this.props.onClick} value={selectedDate.format("MM-DD-YYYY")} InputLabelProps={{ shrink: true }} InputProps={{ className: classes.input, endAdornment: (<CalendarIcon color="primary" />) }} />) } } class DatePicker extends React.Component { render() { const { label, value, minDate, maxDate, onChange } = this.props; return ( <ReactDatePicker selected={value.toDate()} minDate={minDate.toDate()} maxDate={maxDate.toDate()} customInput={<DatePickerInputComp selectedDate={value} label={label} />} onChange={onChange} /> ) } }

El problema:
¿Cómo hago para que la etiqueta 'Para' no aparezca cuando aparece <CalendarIcon> ? Quiero diseñar la 'etiqueta' de apoyo de TextField pero no estoy seguro de cómo puedo hacerlo.

El código actualizado:

 const inputStyles = theme => ({ icon: { zIndex: 1029, }, }); class DatePicker extends React.Component { render() { const { label, value, minDate, maxDate, onChange, } = this.props; const { classes } = this.props; return ( <ReactDatePicker selected={value.toDate()} minDate={minDate.toDate()} maxDate={maxDate.toDate()} customInput={<DatePickerInputComp selectedDate={value} label={label} />} wrapperClassName={classes.icon} onChange={onChange} /> ) } }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Puede agregar un índice z más alto para el componente react-datepicker para que sea visible en la pila superior.

 <ReactDatePicker selected={value.toDate()} minDate={minDate.toDate()} maxDate={maxDate.toDate()} customInput={<DatePickerInputComp selectedDate={value} label={label} wrapperClassName="datePicker" />

Agregué un selector de datePicker para facilitar el estilo.

 .datePicker{ z-index: 999 }

Temporalmente dio el índice z como 999. Puede modificarlo a un valor más bajo después de definir un índice z para el campo de texto.

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!