Skip to main content

Search

Library
UDS Base
Repository
github.com/telus/universal-design-system
Package
npmjs.com/package/@telus-uds/ds-allium
Package version
1.14.0
Loading...

Introduction

import { Search } from '@telus-uds/ds-allium'

Use Search for text-based searching or filtering with optional autocomplete functionality.

Guidance

Search includes a clear button, which will appear as text is entered and pressing it will cause the input's internal state value to be set to an empty string.

Updating parent on changes

Use the onChange prop to react to value changes and the onSubmit prop to react on search submission.

Loading...

Controlled usage

Pass value and onChange to control the search input from a parent.

caution

Allium-branded autocomplete suggestions for Search are still under design consideration.

The below example is only an example of the capabilities of Search props, and not an example of how such a feature should look or behave.

Please contact DPA for advice on design, user experience and accessibility of similar features.

Accessibility

Use the copy prop to select english or french copy for the accessibility labels. You may also pass in a custom dictionary object.

Platform considerations

The component is available on both native platforms and web.

Props

NameTypeDefaultDescription
accessibilityLabelstringUse to provide an accessible label for the input (visually hidden).
copy'en' | 'fr' | { accessibilityLabel: string, clearButtonAccessibilityLabel: string, submitButtonAccessibilityLabel: string }'en'Select English or French copy for the accessible labels. You may also pass in a custom dictionary object.
inactiveboolDisables all user interactions with the search input.
initialValuestringUse this to set the initial value of the search input. Updating 'initialValue' will **not** update the actual value.
onChangefuncUse to react upon search input's value changes. Will receive the searched value as an argument.
onClearfuncTriggered when the clear button is pressed.
onFocusfuncTriggered when the search input is focused.
onSubmitfuncTriggered when the search input is submitted, either by pressing the submit button, "Enter" key on web, or "Search" key in a mobile keyboard.
placeholderstringLabel rendered in the search input when it has no value.
tokenscustomSystem tokens prop, see tokens for more details
variantobjectOfSystem variant prop, see variants for more details

Tokens

In exceptional circumstances, the following tokens can be passed to this component to override its default styles. Do not do this unless absolutely necessary. Read more about overriding styles.

View Tokens
Prop NameToken PropertyToken Type
tokensbackgroundColorcolor
colorcolor
borderWidthborder
borderColorcolor
borderRadiusradius
paddingTopsize
paddingBottomsize
paddingLeftsize
paddingRightsize
outerBackgroundColorcolor
outerBorderWidthborder
outerBorderColorcolor
outerBorderRadiusradius
fontNamefontName
fontWeightfontWeight
fontSizefontSize
lineHeightlineHeight
placeholderColorcolor
buttonsGapsize
clearButtonIconicon
submitButtonIconicon

Figma

Variants

This component has no visual variants but its appearance may change based on the inactive prop:

Loading...

Feedback