React Native · Expo SDK 57 New
Glass Picker
A labelled system picker on glass, with a wheel on iOS and native dropdowns on Android and the web.
npx shadcn@4.14.1 add @glassyui-native/glass-pickerInstallation
Install Glass Picker
npx shadcn@4.14.1 add @glassyui-native/glass-picker
npx expo install --fixRebuild your development build after adding native modules. The Expo guide covers the registry and glass provider.
Usage
Glass Picker usage
import { useState } from 'react';
import { Text, View } from 'react-native';
import { GlassPicker } from '@/components/glassyui/glass-picker';
import { useGlassTheme } from '@/components/glassyui/glass-provider';
const OPTIONS = [
{ value: 'morning', label: 'Morning' },
{ value: 'afternoon', label: 'Afternoon' },
{ value: 'evening', label: 'Evening' },
];
export default function PickerExample() {
const { colors } = useGlassTheme();
const [value, setValue] = useState('morning');
return (
<View style={{ gap: 12 }}>
<GlassPicker
label="Reminder"
options={OPTIONS}
value={value}
onValueChange={setValue}
testID="native-picker"
/>
<Text style={{ color: colors.foreground }} testID="native-picker-value">
{OPTIONS.find((option) => option.value === value)?.label}
</Text>
</View>
);
}
API
| Prop | Type | Use |
|---|---|---|
label | string | Visible and accessible field label. |
options | { label: string; value: string }[] | The available choices. |
value / onValueChange | string / (value: string) => void | The selected value and its change handler. |
appearance | 'menu' | 'wheel' | Defaults to menu. |
disabled | boolean | Prevents selection changes. |
Each component also accepts style and testID.
Notes
- The picker uses SwiftUI on iOS, Jetpack Compose on Android, and a labelled browser select on the web. The wrapper uses GlassSurface.
- The wheel appearance is available on iOS. Android and the web use their standard dropdown.
- Keep value controlled and matched to one option. Each option needs a unique value.