Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

435
Vistas
How to use Material-UI autocomplete component to be able to display and filter multiple words sperated by '-'(dash) for each option effectively

Problem We need Material-UI autocomplete component to be able to display and filter multiple words separated by special characters like'-'(dash) for each option effectively.

Example: option dropdown must have string similar to, Username - Phone.

We have tried https://mui.com/material-ui/react-autocomplete/#search-input, but in my codebase, the filtration action is not accurate. If we use phone number instead in the autocomplete field to filter autocomplete options; we are not getting the right result filtered.

Note: values in option field in the future will include names with special characters in them along with phone number separated by dash.

Code:

import * as React from 'react';
import TextField from '@mui/material/TextField';
import Autocomplete from '@mui/material/Autocomplete';

export default function ComboBox() {
  return (
    <Autocomplete
      disablePortal
      id="combo-box-demo"
      options={Users}
      getOptionLabel={(Users) => Users.label +' - ' + Users.phone}
      sx={{ width: 300 }}
      renderInput={(params) => <TextField {...params} label="Users" />}
    />
  );
}

// Userslists
const Users= [
  { label: 'username1', phone: 912345121},
  { label: 'username2', phone: 912345122},
  { label: 'username3', phone: 212345676},
  { label: 'username4', phone: 333223311},
  { label: 'username5', phone: 777777232},
  { label: 'username6', phone: 787873333},
];

All comments are welcome :)

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda