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

252
Vistas
React - Drop down list on typing specific character in input field(example - {{ or @ )

I need to show a list or dropdown when user enters a specific character like '@' or '{{ }}' in the input text area, from which an option can be selected and then used in the text area. Is there any specific library for this in React.js? Or any short solution for this in React?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can monitor the input from the text area and check for the specific character with a regex. Use a state that mounts a component with suggestions when true. Selecting an option would insert it in the text and set the mount state to false. Clicking away should do the same (and MUI includes a click away listener helper component).

Here is a small demo as a proof-of-concept: https://codesandbox.io/s/magical-browser-dk981?file=/src/App.tsx

Note: I've used Recoil to manage the shared state, because I really like it. If you don't want to use Recoil, you have to declare all state in the parent component and pass it down as props to the child.

This demo is obviously not polished, there are no intelligent suggestions as you type, you'll have to implement that yourself. Good luck. :)

about 4 years ago · Juan Pablo Isaza Denunciar
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