This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.
Reference Expo UI Jetpack Compose SearchBar A Jetpack Compose SearchBar component for search input functionality.
Recommended version:
~58.1.0
Expo UI SearchBar matches the official Jetpack Compose Search API and provides a search input with support for placeholder text and expanded full-screen search.
Installation
- npx expo install @expo/ui
- yarn expo install @expo/ui
- pnpm expo install @expo/ui
- bun expo install @expo/ui
If you are installing this in an existing React Native app , make sure to install expo in your project.
Usage
Basic search bar
BasicSearchBarExample.tsx import { useState } from 'react' ;
import { Host , SearchBar } from '@expo/ui/jetpack-compose' ;
export default function BasicSearchBarExample ( ) {
const [ query, setQuery] = useState ( '' ) ;
return (
< Host matchContents >
< SearchBar onSearch = { searchText => setQuery ( searchText) } />
</ Host >
) ;
}
Search bar with placeholder
Use the SearchBar.Placeholder sub-component to display hint text when the search field is empty.
SearchBarPlaceholderExample.tsx import { useState } from 'react' ;
import { Host , SearchBar , Text } from '@expo/ui/jetpack-compose' ;
export default function SearchBarPlaceholderExample ( ) {
const [ query, setQuery] = useState ( '' ) ;
return (
< Host matchContents >
< SearchBar onSearch = { searchText => setQuery ( searchText) } >
< SearchBar.Placeholder >
< Text > Search items... </ Text >
</ SearchBar.Placeholder >
</ SearchBar >
</ Host >
) ;
}
API
import { SearchBar } from '@expo/ui/jetpack-compose' ;
Components ExpandedFullScreenSearchBarType: React.Element < ExpandedFullScreenSearchBarProps>
ExpandedFullScreenSearchBar component for SearchBar.
This component marks its children to be rendered in the expanded full-screen search bar.
Type: React.Element < SearchBarProps>
Renders a SearchBar component.
Optional • Type:
ReactNode The children of the component.
Optional • Type: ModifierConfig[]
Modifiers for the component.
Optional • Type: ( searchText: string ) => void
Callback function that is called when the search text is submitted.
Type: React.Element < PlaceholderProps>
Placeholder component for SearchBar.
This component marks its children to be rendered in the placeholder slot.