Typeahead component setup

task brazil Updated Sep 10, 2026 6 min read typeahead-component-uib-setup.md
Raw file servicenow.com

The Typeahead component provides users with a relevant dropdown of selectable options as they type in an input field.

Before you begin

This task assumes you have placed the component on the page and are ready to configure the properties and events. For instructions on accessing and using features in UI Builder, see Customize UI Builder pages using components.

Note: This document describes the latest component functionality. Go to the store to make sure you have the latest version of the component.

Role required: admin or ui_builder_admin

Procedure

  1. Define a label for your Typeahead that differentiates it from other components in the content tree.

    A label makes finding the component easier in a large list of components. For instructions on using the content tree, see Manage UI pages and page variants.

    [Omitted image "typeahead-multi-content-tree.png"] Alt text: Image showing Typeahead component content tree

  2. Select the Typeahead component, using one of these methods:

    • Click anywhere within the component.
    • Select the Typeahead label you created for your component in the content tree. The property fields appear in the Config tab in the setup panel on the right.

Parent Topic:UIB Setup Information

Typeahead component properties

Define the controls to filter the search as the user types into the integrated search input fields and the search behavior of the Typeahead component with these properties.

To configure the properties, enter either static or dynamic input. Enter dynamic input by selecting the input type.

Label [property]

Description

Size[size]

Size of the component in either small or medium.Default: medium

Search behavior[search]

Control to filter the items in the integrated search input.

Disabled[disabled]

Disables user click interactions when True. The typeahead component is grayed out when disabled.

Read-only[readonly]

By enabling this property, the user cannot modify the value of the input field. The input field is not disabled in this setting.

Auto-focus[autofocus]

When True, the focus is automatically placed inside the input field when the page loads.

Field layout configuration[fieldLayout]

Determines whether the labels, field, and slotted content are arranged vertically or horizontally. This property also determines the respective proportions of each element in a horizontal container. The field layout has two configuration properties:

  • layout (string):
    • "layout":"horizontal": Horizontally aligns the label with the field; the label displays to the left of the field.
    • "layout":"vertical" (default): Vertically aligns the label with the field; the label displays above the field.
  • columns (array): If the layout is horizontal, the component uses the columns array to set the grid template column width for the containers.

Label [property]

Description

Placeholder text[placeholder]

Hint about the expected input text.

Value[value]

Value for the input field.Note: This field remains empty unless it has pre-populated data.

Manage value[manageValue]

If set to true, overrides automatic updates to the Value property. Use the Text entered event to intercept the requested change and handle it manually.Default: false

Name[name]

Name of the field control.

Max. characters[maxLength]

Maximum number of characters for the typeahead field.

Label [property]

Description

List items[items]

Possible items for selection.

Selected item[selectedItem]

ID of the selected item.

Manage selected item[manageSelectedItem]

If set to true, overrides automatic updates to the Selected item property. Use the Item selected event to intercept the requested change and handle it manually.Default: false

Item size constraints[itemListConstrain]

Sizing constraints on the items list.

Label [property]

Description

Label[label]

Purpose of the selected field.

Wrap label[wrapLabel]

If the label doesn't fit on one line, wraps the label.

Required[required]

Use this property to indicate that the user must enter a value in the field before proceeding.Default: false

Hide required indicator[hideRequiredIndicator]

When true, the graphic that indicates the field is required is visually hidden. Set this property to true for forms where most fields are required. If this property is true, also set the Optional flag for any fields that are not requiredDefault: false

Optional[optional]

Visually indicates that the field is optional.Default: false

Helper text[helperContent]

Hint text to the users.

Label [property]

Description

Invalid[invalid]

When true, this flag indicates that the field is in an incorrect state. This information is visually reflected in the field display. This property is set automatically based on the current validity of the input field.

Manage invalid[manageInvalid]

If set to true, overrides automatic updates to the Invalid property. Use the Typeahead invalid set to intercept the requested change and handle it manually.Default: false

Alert messages[messages]

Array of alert messages that display below the field. The following list describes each object's properties:- content: The text of the alert message.

  • status: The type of alert to display.
  • icon: Icon to display at the start of the alert message.

Default:

CSS
{    "name": "content",    "label": "Content",    "fieldType": "string",    "translatable": true},{    "name": "status",    "label": "Status",    "fieldType": "choice",    "typeMetadata": {        "choices": [            {                "label": "Critical",                "value": "critical"            },            {                "label": "Warning",                "value": "warning"            },            {                "label": "Positive",                "value": "positive"            },            {                "label": "Info",                "value": "info"            },            {                "label": "Suggestion",                "value": "suggestion"            }        ]    }},{    "name": "icon",    "label": "Icon",    "fieldType": "icon"}

Label [property]

Description

ARIA properties[configAria]

A JSON field for configuring ARIA properties, such as aria-braillelabel.

Landmark[landmark]

Enable the Landmark Focus keyboard shortcut to focus on this typeahead.

## Typeahead component events

Select event handlers to configure the actions (events) provided with the Typeahead component.

The Events tab shows the events used by the Typeahead component. To view the available events, select + Add event mapping. Select the event in the list to add one or more event handlers.

Event handlers

Event handlers work with data resources to link the Typeahead actions to the data you want to display to your users. Select the event in the list to add one or more event handlers.

For instructions on adding event handlers to an event, see Configure an event handler.

Event descriptions

Event

Description

Typeahead list visible

Dispatched when the typeahead menu opens and renders the content. This event is dispatched only after the typeahead menu is rendered in the DOM API. The payload contains the components inner now-dropdown-list element.

Typeahead list hidden

Dispatched when the typeahead menu has been closed and removed.

Typeahead invalid set

Dispatched when interaction with a field is complete and the validity of the field has changed.

Item selected

Dispatched when the user selects an item from the dropdown.

Text entered

Dispatched when the user types or pastes text in the field.

Typeahead enter keydown

Dispatched when the Enter key is pressed while focus is inside the typeahead, without highlighting an item from the items list. The payload contains the following:- name: Name of the input field

  • value: Value of the input field
Search documentation
Search document titles and file paths on the brazil branch