Skip to content

SheetPicker

A searchable picker component that opens a modal bottom sheet with a search field. Ideal for long lists like countries, languages, or categories.

import { SheetPicker } from '@mgcrea/react-native-jetpack-compose';
const [country, setCountry] = useState<string | null>(null);
<SheetPicker
label="Country"
value={country}
onSelect={setCountry}
title="Select Country"
options={[
{ value: 'us', label: 'United States' },
{ value: 'uk', label: 'United Kingdom' },
{ value: 'ca', label: 'Canada' },
// ... more options
]}
/>
PropTypeDefaultDescription
optionsSheetPickerOption[]RequiredArray of selectable options
valuestring | nullnullCurrently selected value
titlestring-Title at top of sheet
searchPlaceholderstring-Placeholder for search field
autoDismissbooleantrueAuto-dismiss after selection
maxHeightRationumber0.9Max height as ratio of screen (0-1)
sheetMaxWidthnumber-Max width in dp (centers sheet)
labelstring-Floating label for text field
placeholderstring-Placeholder when no selection
disabledbooleanfalseDisable the picker
styleViewStyle-Container style
EventTypeDescription
onSelect(value: string) => voidCalled when option selected
onDismiss() => voidCalled when sheet dismissed
interface SheetPickerOption {
value: string; // Unique identifier
label: string; // Display text (also used for search)
}
const [country, setCountry] = useState<string | null>(null);
const countries = [
{ value: 'af', label: 'Afghanistan' },
{ value: 'al', label: 'Albania' },
{ value: 'dz', label: 'Algeria' },
// ... 200+ countries
{ value: 'zw', label: 'Zimbabwe' },
];
<SheetPicker
label="Country"
value={country}
onSelect={setCountry}
title="Select Country"
searchPlaceholder="Search countries..."
options={countries}
/>
const [language, setLanguage] = useState<string | null>('en');
<SheetPicker
label="Preferred Language"
value={language}
onSelect={setLanguage}
title="Select Language"
searchPlaceholder="Search languages..."
options={[
{ value: 'en', label: 'English' },
{ value: 'es', label: 'Spanish' },
{ value: 'fr', label: 'French' },
{ value: 'de', label: 'German' },
{ value: 'it', label: 'Italian' },
{ value: 'pt', label: 'Portuguese' },
{ value: 'zh', label: 'Chinese' },
{ value: 'ja', label: 'Japanese' },
{ value: 'ko', label: 'Korean' },
{ value: 'ar', label: 'Arabic' },
]}
/>

Keep the sheet open after selection (useful for multi-step flows):

const [value, setValue] = useState<string | null>(null);
<SheetPicker
label="Selection"
value={value}
onSelect={setValue}
autoDismiss={false}
onDismiss={() => console.log('Sheet closed')}
options={options}
/>

Control the sheet height and width:

<SheetPicker
label="Selection"
value={value}
onSelect={setValue}
maxHeightRatio={0.5} // Half screen height
sheetMaxWidth={400} // Max 400dp wide, centered
options={options}
/>

For categorized options, format labels to indicate grouping:

const categories = [
{ value: 'electronics-phones', label: 'Electronics > Phones' },
{ value: 'electronics-laptops', label: 'Electronics > Laptops' },
{ value: 'electronics-tablets', label: 'Electronics > Tablets' },
{ value: 'clothing-mens', label: 'Clothing > Men\'s' },
{ value: 'clothing-womens', label: 'Clothing > Women\'s' },
{ value: 'home-furniture', label: 'Home > Furniture' },
{ value: 'home-decor', label: 'Home > Decor' },
];
<SheetPicker
label="Category"
value={category}
onSelect={setCategory}
title="Select Category"
searchPlaceholder="Search categories..."
options={categories}
/>
const [products, setProducts] = useState<SheetPickerOption[]>([]);
const [selectedProduct, setSelectedProduct] = useState<string | null>(null);
useEffect(() => {
fetchProducts().then(data => {
setProducts(data.map(p => ({
value: p.id,
label: p.name,
})));
});
}, []);
<SheetPicker
label="Product"
value={selectedProduct}
onSelect={setSelectedProduct}
title="Select Product"
searchPlaceholder="Search products..."
options={products}
/>
FeaturePickerSheetPicker
Best forShort lists (<10 items)Long lists (10+ items)
SearchNoYes
PresentationDropdown menuBottom sheet
Screen usageMinimalUp to 90% height
  • Use descriptive labels in options - they’re used for search matching
  • Set a meaningful title to help users understand what they’re selecting
  • For very long lists, ensure options are sorted logically (alphabetically, by popularity, etc.)