Skip to main content

SearchInput

A Search component with debouncing support, internally it extends the TextInput and it's all props.

Usage

Search user
function SearchInputUsage() {
return (
<View>
<SearchInput
label="Search user"
placeholder="eg. Blossom"
size="medium"
/>
</View>
)
}

AnimatedSearchInput

Search Label
Search 'Awesome'
Search Placeholder
Search 'Awesome'
function AnimatedSearchInput() {
const placeholders = [
`Search 'Awesome'`,
`Search 'Blossom'`,
`Search 'Rose'`,
`Search 'Daisy'`,
`Search 'Tulip'`,
`Search 'Orchid'`,
]

return (
<View>
<SearchInput
label="Search Label"
size="medium"
animatedPlaceholderProps={{
placeholders,
}}
left={<Icon name="search" size={24} />}
/>
<SearchInput
label="Search Placeholder"
mode="flat"
animatedPlaceholderProps={{
placeholders,
}}
/>
</View>
)
}

Modes

Search user
Search user
function SearchInputModes() {
return (
<View>
<SearchInput label="Search user" placeholder="eg. Blossom" mode="flat" />
<SearchInput
label="Search user"
placeholder="eg. Blossom"
size="medium"
mode="outlined"
/>
</View>
)
}

Size

Search user
Search user
Search user
Search user
Search user
Search user
function SearchInputSizes() {
return (
<View>
<SearchInput label="Search user" placeholder="eg. Blossom" size="small" />
<SearchInput
label="Search user"
placeholder="eg. Blossom"
size="medium"
/>
<SearchInput label="Search user" placeholder="eg. Blossom" size="large" />

<SearchInput
mode="flat"
label="Search user"
placeholder="eg. Blossom"
size="small"
/>
<SearchInput
mode="flat"
label="Search user"
placeholder="eg. Blossom"
size="medium"
/>
<SearchInput
mode="flat"
label="Search user"
placeholder="eg. Blossom"
size="large"
/>
</View>
)
}

Props

PropData TypeDefault ValueDescription
ExtendsTextInputProps--Inherits properties from TextInputProps
withClearIconbooleanfalseWhether to show a clear (X) icon to reset the input at the right.Set it to true to show the clear icon.
onQueryChange(query: string) => void--Callback when the search query changes.
debounceDelaynumber300Delay in milliseconds to debounce the query change callback.
animatedPlaceholderPropsAnimatedPlaceholderProps--Customize the animated placeholder behavior with a slide-up animation.
mode"outlined" | "flat"outlinedControl the different modes of the text input
denseboolean--Have a denser background in the text input
labelstring--Label text above the input
placeholderstring--Placeholder for the text input
placeholderComponentReactNode--Render a custom Placeholder component for the text input
captionstring--Caption text below the text input
errorstring--Error text in error status below caption text
labelStyleStyleProp<TextStyle>--Label text style
placeholderStyleStyleProp<TextStyle>--Placeholder text style
captionStyleStyleProp<TextStyle>--Caption text style
errorStyleStyleProp<TextStyle>--Error text style
containerStyleStyleProp<ViewStyle>--Container view style
inputStyleStyleProp<ViewStyle>--Input box style
textStyleStyleProp<TextStyle>--Input text style equivalent to react-native style for TextInput
disabledboolean--Set to true to disable the button
shouldMockDisableStateboolean--Mock the disable behavior not the styling for popover contained inputs
leftReactNode--Render Icon/JSX on the left of the button
rightReactNode--Render Icon/JSX on the right of the button
statusBlossomStatusprimary--
sizeBlossomSizemedium--