Tonic UI
Getting StartedColor ModeColor StyleVersionsContributing
THEME
BordersBreakpointsColorsOutlinesPositionsSpacingSizesShadowsTypography
BUILDING BLOCKS
BoxControlBox
UTILITIES

SearchInput

Import

Usage

EDITABLE EXAMPLE

Keyword search

This example shows how to create a keyword search component with the following features:

  • Automatically adjust the width of an input element
  • Handle focus and blur events
  • Trigger search when pressed Enter key
  • Display a loading indicator that recognizes the loading state
EDITABLE EXAMPLE

Sizes

Use the size prop to change the size of the SearchInput. You can set the value to sm, md, or lg.

EDITABLE EXAMPLE

Variants

The SearchInput component comes in 3 variants: outline, filled, and unstyled. Pass the variant prop and set it to either of these values.

EDITABLE EXAMPLE

Attributes

Standard input attributes are supported, e.g., disabled, readOnly, required, etc.

disabled

EDITABLE EXAMPLE

readOnly

EDITABLE EXAMPLE

required

EDITABLE EXAMPLE

Props

NameTypeDefaultDescription
isInvalidbooleanIf true, the input will indicate an error. You can style this state by passing the _invalid prop.
isLoadingbooleanIf true, then display the loading spinner.
onChangefunctionA callback called when the value is changed.
onClearInputfunctionA callback called when the clear button is clicked.
sizestring'md'The visual size of the input element. One of: 'sm', 'md', 'lg'
variantstring'outline'The variant of the input style to use. One of: 'outline', 'filled', 'unstyled'
disabledbooleanIf true, the user cannot interact with the control. This sets aria-disabled=true and you can style this state by passing the _disabled prop.
readOnlybooleanIf true, prevents the value of the input from being edited.