Edit page

Search

Search input with specific styles.

Import Syntax

Basic Usage

Alternate Styles

minimal
appendToBody
fullWidth

Use Remote Data

remote

Replace Search Icon

searchIcon={<FileMagnifyingGlassIcon size={16} />}
searchIcon={false}

Array of Objects

Child Items

Custom Items

Dumb Input

uncontrolled

Shortcut Character

/

Virtualized

Custom Styled Input

Props

PropertyTypeRequiredDefaultDescription
placeholderStringfalseSearch...Text for the placeholder property on the input.
dataSourceConfigObjectfalse{ label: label, value: value }An object used to map properties to the name and value of items (only applies if `items` is an array of objects).
placementEnumfalsebottom-startPlacement of the popover in relation to the target.
shortcutTooltipNodefalsePress / to searchText used in the shortcut tooltip to describe what the shortcut is.
virtualizedRowHeightUnionfalse42(virtualized only) Row height used to calculate how many rows to render in a virtualized menu.
searchIconNodefalse<MagnifyingGlassIcon filled size={16} />SVG icon to be displayed inside the Search input
clearIconNodefalse<XCircleIcon filled size={16} color={CalciteTheme.palette.darkerGray} />SVG icon to clear the value of the Search input
onUserActionFuncfalse() => {}Function called when the input value is changed, items dropdown hides/shows, or when the user hovers over or clicks on an item.
onChangeFuncfalse() => {}Function called when an item is selected.
onRequestClearFuncfalse() => {}Function called when the user clicks the clear button.
remoteBoolfalsefalseUse a remote API for the data load. This will allow the application to see the exact return from the API with no filtering applied
itemsArrayfalse-Array of items.
inputValueStringfalse-Text in the input.
selectedItemAnyfalse-The selected item.
minimalBoolfalse-Toggle minimal style on the input.
fullWidthBoolfalse-Whether or not the Search and its menu will fill the container's width.
containerStyleObjectfalse-Style prop applied to the Search container element.
menuStyleObjectfalse-Style prop applied to the menu wrapper.
shortcutCharacterStringfalse-Character used to display a shortcut icon on the right side of the Search input.
positionFixedBoolfalse-Uses `position: fixed` on the tooltip allowing it to show up outside of containers that have `overflow: hidden`.
childrenNodefalse-You can add Search options as children if you want more control over the item rendering. Search MenuItems can take either an item object that maps to your dataSourceConfig, or you can manually set the label and value props on MenuItems.
virtualizedBoolfalse-Use react-virtualized to render rows as the user scrolls.
virtualizedMenuWidthNumberfalse-(virtualized only) Width of the menu; unloaded rows may be wider than the initial set.
popperModifiersObjectfalse-Modifiers to be passed to the Popper element