Typeahead Input

Components > Editing Data > Typeahead Input
Use this component to...
Prompt the user for a text value, showing them possible matches while they type

Overview

Use the typeahead component to prompt the user for a text value, showing them possible matches in a dropdown menu while they type.

The user can quickly select an item from the menu rather than having to type out the whole word, which can be a real time saver.

The user has typed “ca” into this text input so far. The typeahead functionality helps the user by displaying a list of possible matches while they user types.
Typeahead example

Development

Web component development

Component reference

typeahead
typeahead
Module: TypeaheadModule - Package: ngx-bootstrap
⚠️ This component requires the use of Angular and will not work in non-Angular applications.

Provides predictive typeahead list for your text list editor

View the typeahead reference doc

Implementation

Begin by importing the TypeaheadModule module into your application.

Import the module
import { TypeaheadModule } from 'ngx-bootstrap/typeahead';

Then bind typeahead to a list of all string values possible for the field. Set typeaheadOptionsLimit to the max number of items you want the typeahead to drop down as suggestions. You must wrap the input in a div with position:relative in order for the typeahead popup to line up with the input.

Typeahead HTML
<div style="position:relative">

    <input id="Country" formControlName="country" type="text" class="rui-form-control" required
        autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
        [typeahead]="countryList" typeaheadOptionsLimit="12" />

</div>

Angular component development

Component reference

typeahead
typeahead
Module: TypeaheadModule - Package: ngx-bootstrap

Provides predictive typeahead list for your text list editor

View the typeahead reference doc

Implementation

Begin by importing the TypeaheadModule module into your application.

Import the module
import { TypeaheadModule } from 'ngx-bootstrap/typeahead';

Then bind typeahead to a list of all string values possible for the field. Set typeaheadOptionsLimit to the max number of items you want the typeahead to drop down as suggestions. You must wrap the input in a div with position:relative in order for the typeahead popup to line up with the input.

Typeahead HTML
<div style="position:relative">

    <input id="Country" formControlName="country" type="text" class="rui-form-control" required
        autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
        [typeahead]="countryList" typeaheadOptionsLimit="12" />

</div>

Design

Figma design

Figma design info
You can find this component in the Components - Forms page in the Figma UI Kit.
Dev Component Design Component Name
Text input JHA / Forms / Text Input; set State to “Watermark” if you want to show watermark text instead of user input, otherwise leave State as “Normal”

Adobe XD design

Adobe XD design info
You can find this component in these artboards in the Adobe XD design samples:
  • Sample App - Editing Form Data
Dev Component Design Component Name
Text input

JHA / Forms / Text Input

  • Select the “Watermark Text” state in the component if you want to show watermark text instead of user input.

Support options
Have questions on this topic?
Join the Responsive UI team in Microsoft Teams to connect with the community.
See something in this page that needs to change?
Send us feedback on this page.
Last updated Wed Mar 29 2023