Quick Start
TextField
import React, { useState } from 'react';
import { View } from 'react-native';
import { TextField } from 'react-native-platform-components';
export function SignUpForm() {
const [email, setEmail] = useState('');
const [password, setPassword] = useState('');
const emailError =
email.length > 0 && !email.includes('@') ? 'Enter a valid email' : undefined;
return (
<View style={{ padding: 16, gap: 12 }}>
<TextField
label="Email"
placeholder="you@example.com"
supportingText="We never share it"
value={email}
onChangeText={setEmail}
error={emailError}
keyboardType="email-address"
autoComplete="email"
autoCapitalize="none"
clearButtonMode="while-editing"
/>
<TextField
label="Password"
value={password}
onChangeText={setPassword}
secureTextEntry
passwordToggle
autoComplete="new-password"
supportingText="At least 8 characters"
/>
<TextField
label="Notes"
multiline
maxLength={200}
showCharacterCount
android={{ variant: 'filled' }}
/>
</View>
);
}
DatePicker (Modal)
import { DatePicker } from 'react-native-platform-components';
export function Example() {
const [date, setDate] = React.useState<Date | null>(null);
const [visible, setVisible] = React.useState(false);
return (
<>
<Button title="Pick date" onPress={() => setVisible(true)} />
<DatePicker
date={date}
visible={visible}
presentation="modal"
mode="date"
onConfirm={(d, confirmed) => {
setDate(d);
if (confirmed) setVisible(false);
}}
onClosed={() => setVisible(false)}
ios={{ preferredStyle: 'inline' }}
android={{ material: 'system' }}
/>
</>
);
}
DatePicker (Embedded)
import { DatePicker } from 'react-native-platform-components';
export function Example() {
const [date, setDate] = React.useState<Date | null>(new Date());
return (
<DatePicker
date={date}
presentation="embedded"
mode="date"
onConfirm={(d, confirmed) => setDate(d)}
ios={{ preferredStyle: 'inline' }}
android={{ material: 'system' }}
/>
);
}
ContextMenu (Gesture Mode)
import { ContextMenu } from 'react-native-platform-components';
import { Platform, View, Text } from 'react-native';
export function Example() {
const [lastAction, setLastAction] = React.useState<string | null>(null);
return (
<ContextMenu
title="Options"
actions={[
{
id: 'copy',
title: 'Copy',
image: Platform.OS === 'ios' ? 'doc.on.doc' : 'content_copy',
},
{
id: 'share',
title: 'Share',
image: Platform.OS === 'ios' ? 'square.and.arrow.up' : 'share',
},
{
id: 'delete',
title: 'Delete',
image: Platform.OS === 'ios' ? 'trash' : 'delete',
attributes: { destructive: true },
},
]}
onPressAction={(id, title) => setLastAction(title)}
>
<View
style={{ padding: 20, backgroundColor: '#E8F4FD', borderRadius: 8 }}
>
<Text>Long-press me</Text>
</View>
</ContextMenu>
);
}
ContextMenu (Modal Mode)
import { ContextMenu } from 'react-native-platform-components';
import { View, Text } from 'react-native';
export function Example() {
return (
<ContextMenu
title="Actions"
actions={[
{ id: 'edit', title: 'Edit' },
{ id: 'duplicate', title: 'Duplicate' },
{ id: 'delete', title: 'Delete', attributes: { destructive: true } },
]}
trigger="tap" // or "longPress" (default)
onPressAction={(id) => console.log('Selected:', id)}
>
<View style={{ padding: 16, backgroundColor: '#eee' }}>
<Text>Tap or long-press me</Text>
</View>
</ContextMenu>
);
}
ContextMenu (Opened from JS)
import { useState } from 'react';
import { ContextMenu } from 'react-native-platform-components';
import { Button, View } from 'react-native';
export function Example() {
const [open, setOpen] = useState(false);
return (
<ContextMenu
trigger="none" // the content keeps its own touches
visible={open}
onMenuClose={() => setOpen(false)}
actions={[
{ id: 'photo', title: 'Photo Library' },
{ id: 'camera', title: 'Camera' },
]}
onPressAction={(id) => console.log('Selected:', id)}
>
<View style={{ padding: 16, backgroundColor: '#eee' }}>
<Button title="Add a file" onPress={() => setOpen(true)} />
</View>
</ContextMenu>
);
}
visible opens the menu on Android and on iOS 17.4+.
ActionSheet
import { useState } from 'react';
import { ActionSheet, Button } from 'react-native-platform-components';
export function Example() {
const [open, setOpen] = useState(false);
return (
<ActionSheet
visible={open}
title="Add a file"
actions={[
{ id: 'library', title: 'Photo Library', image: { ios: 'photo', android: 'photo_library' } },
{ id: 'camera', title: 'Take Photo', image: { ios: 'camera', android: 'photo_camera' } },
{ id: 'remove', title: 'Remove File', attributes: { destructive: true } },
]}
onSelect={(id) => {
setOpen(false);
console.log('Selected:', id);
}}
onCancel={() => setOpen(false)}
>
{/* The iPad (and iOS 26) popover points at the children */}
<Button label="Add File…" onPress={() => setOpen(true)} />
</ActionSheet>
);
}
Dialog
import { useState } from 'react';
import { Button, Dialog } from 'react-native-platform-components';
export function Example() {
const [open, setOpen] = useState(false);
return (
<>
<Button label="Delete Photo…" onPress={() => setOpen(true)} />
<Dialog
visible={open}
title="Delete this photo?"
message="It will be removed from all your devices."
actions={[
{ id: 'cancel', title: 'Cancel', role: 'cancel' },
{ id: 'delete', title: 'Delete', role: 'destructive', preferred: true },
]}
onSelect={(id) => {
setOpen(false);
console.log('Selected:', id);
}}
onCancel={() => setOpen(false)}
onPresentFailed={() => setOpen(false)}
/>
</>
);
}
SelectionMenu (Headless)
import { SelectionMenu } from 'react-native-platform-components';
const options = [
{ label: 'Apple', data: 'apple' },
{ label: 'Banana', data: 'banana' },
{ label: 'Orange', data: 'orange' },
];
export function Example() {
const [visible, setVisible] = React.useState(false);
const [value, setValue] = React.useState<string | null>(null);
return (
<>
<Button title="Open menu" onPress={() => setVisible(true)} />
<SelectionMenu
options={options}
selected={value}
visible={visible}
onSelect={(data) => {
setValue(data);
setVisible(false);
}}
onRequestClose={() => setVisible(false)}
/>
</>
);
}
SelectionMenu (Inline)
import { SelectionMenu } from 'react-native-platform-components';
const options = [
{ label: 'Apple', data: 'apple' },
{ label: 'Banana', data: 'banana' },
{ label: 'Orange', data: 'orange' },
];
export function Example() {
const [value, setValue] = React.useState<string | null>(null);
return (
<SelectionMenu
options={options}
selected={value}
presentation="embedded"
placeholder="Select fruit"
onSelect={(data) => setValue(data)}
android={{ material: 'm3' }}
/>
);
}
SegmentedControl
import { SegmentedControl } from 'react-native-platform-components';
const segments = [
{ label: 'Day', value: 'day' },
{ label: 'Week', value: 'week' },
{ label: 'Month', value: 'month' },
];
export function Example() {
const [selected, setSelected] = React.useState('day');
return (
<SegmentedControl
segments={segments}
selectedValue={selected}
onSelect={(value) => setSelected(value)}
/>
);
}
SegmentedControl (With Icons)
import { SegmentedControl } from 'react-native-platform-components';
const segments = [
{
label: 'List',
value: 'list',
// Native symbol on each platform, no Platform.OS branching
icon: {
ios: { type: 'sfSymbol', name: 'list.bullet' },
android: { type: 'drawable', name: 'list_bullet' },
},
},
{
label: 'Alerts',
value: 'alerts',
// One image asset shared by both platforms, tinted like a template
icon: { type: 'image', source: require('./bell.png') },
},
];
export function Example() {
const [selected, setSelected] = React.useState('list');
return (
<SegmentedControl
segments={segments}
selectedValue={selected}
onSelect={(value) => setSelected(value)}
// 'auto' | 'labeled' | 'unlabeled'
labelVisibility="auto"
ios={{ apportionsSegmentWidthsByContent: true }}
/>
);
}
TabBar
import { TabBar } from 'react-native-platform-components';
const tabs = [
{
label: 'Home',
value: 'home',
icon: { ios: 'house', android: 'home' },
// The filled SF Symbol while selected, as the system apps do
selectedIcon: { ios: 'house.fill' },
},
{ label: 'Search', value: 'search', icon: { ios: 'magnifyingglass', android: 'search' } },
{ label: 'Inbox', value: 'inbox', icon: { ios: 'bell', android: 'notifications' }, badge: 3 },
];
export function Example() {
const [tab, setTab] = React.useState('home');
return <TabBar items={tabs} selectedValue={tab} onSelect={setTab} />;
}
NavigationRail
import { Button, NavigationRail } from 'react-native-platform-components';
import { Text, View } from 'react-native';
const destinations = [
{ label: 'Home', value: 'home', icon: { ios: 'house', android: 'home' } },
{ label: 'Search', value: 'search', icon: { ios: 'magnifyingglass', android: 'search' } },
{ label: 'Inbox', value: 'inbox', icon: { ios: 'bell', android: 'notifications' }, badge: 3 },
];
export function Example() {
const [destination, setDestination] = React.useState('home');
return (
// The rail at the start of a row, the screen beside it
<View style={{ flex: 1, flexDirection: 'row' }}>
<NavigationRail
items={destinations}
selectedValue={destination}
onSelect={setDestination}
header={
<Button
icon={{ ios: 'square.and.pencil', android: 'edit' }}
accessibilityLabel="Compose"
variant="tonal"
size="medium"
shape="square"
onPress={() => console.log('Compose')}
/>
}
/>
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
<Text>{destination}</Text>
</View>
</View>
);
}
Button
import { Button } from 'react-native-platform-components';
export function Example() {
return (
<>
{/* Material 3 Expressive filled button on Android, UIButton .filled() on iOS */}
<Button label="Save" onPress={() => console.log('save')} />
{/* Lower emphasis, larger size, square corners */}
<Button
label="Cancel"
variant="text"
size="medium"
shape="square"
onPress={() => console.log('cancel')}
/>
{/* Icon-only button: a Material icon button on Android */}
<Button
icon={{
ios: { type: 'sfSymbol', name: 'plus' },
android: { type: 'drawable', name: 'add' },
}}
variant="tonal"
accessibilityLabel="Add"
onPress={() => console.log('add')}
/>
</>
);
}
ButtonGroup
import { ButtonGroup } from 'react-native-platform-components';
export function Example() {
const [range, setRange] = React.useState<string[]>(['week']);
return (
<>
{/* Actions: a standard group, buttons keep their shape */}
<ButtonGroup
buttons={[
{ label: 'Copy', value: 'copy' },
{ label: 'Paste', value: 'paste' },
]}
variant="tonal"
onPress={(value) => console.log(value)}
/>
{/* Single selection: a connected group, the Expressive segmented buttons */}
<ButtonGroup
buttons={[
{ label: 'Day', value: 'day' },
{ label: 'Week', value: 'week' },
{ label: 'Month', value: 'month' },
]}
selection="single"
selectedValues={range}
onSelectionChange={setRange}
/>
</>
);
}
SplitButton
import { SplitButton } from 'react-native-platform-components';
export function Example() {
return (
<SplitButton
label="Reply"
menu={[
{ id: 'reply-all', title: 'Reply All' },
{ id: 'forward', title: 'Forward' },
]}
menuAccessibilityLabel="Reply options"
onPress={() => console.log('reply')}
onMenuSelect={(id) => console.log(id)}
/>
);
}
Chip and ChipGroup
import { useState } from 'react';
import { Chip, ChipGroup } from 'react-native-platform-components';
export function Example() {
const [timeFrame, setTimeFrame] = useState(['month']);
const [filters, setFilters] = useState(['vegan', 'gluten']);
return (
<>
{/* Single selection that wraps onto rows */}
<ChipGroup
chips={[
{ value: 'week', label: 'Last week' },
{ value: 'month', label: 'Last month' },
{ value: 'year', label: 'Last year' },
{ value: 'all', label: 'All time' },
]}
selection="single"
selectedValues={timeFrame}
onSelectionChange={setTimeFrame}
/>
{/* Removable input chips */}
<ChipGroup
variant="input"
chips={filters.map((value) => ({ value, label: value }))}
onClose={(value) => setFilters((f) => f.filter((v) => v !== value))}
/>
<Chip
label="Add to calendar"
icon={{ ios: 'calendar', android: 'calendar' }}
onPress={() => console.log('calendar')}
/>
</>
);
}
Switch
import { useState } from 'react';
import { Switch } from 'react-native-platform-components';
export function Example() {
const [wifi, setWifi] = useState(true);
const [notifications, setNotifications] = useState(false);
return (
<>
{/* A settings row: the whole row toggles */}
<Switch
style={{ paddingHorizontal: 16, minHeight: 48 }}
label="Wi-Fi"
value={wifi}
onValueChange={setWifi}
/>
{/* A switch on its own, with a check icon on Android */}
<Switch
accessibilityLabel="Notifications"
value={notifications}
onValueChange={setNotifications}
android={{ thumbIcon: 'check' }}
/>
</>
);
}
Checkbox and RadioGroup
import { useState } from 'react';
import { Checkbox, RadioGroup } from 'react-native-platform-components';
export function Example() {
const [accepted, setAccepted] = useState(false);
const [delivery, setDelivery] = useState<string | null>(null);
return (
<>
<Checkbox
label="I have read and agree to the Terms of Service."
checked={accepted}
onCheckedChange={setAccepted}
/>
<RadioGroup
accessibilityLabel="Delivery method"
options={[
{ value: 'standard', label: 'Standard', description: '3–5 business days' },
{ value: 'express', label: 'Express', description: 'Next business day' },
]}
value={delivery}
onValueChange={setDelivery}
error={delivery ? undefined : 'Choose a delivery method'}
/>
</>
);
}
FloatingActionButton
import { FloatingActionButton } from 'react-native-platform-components';
import { View } from 'react-native';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
export function Example() {
const insets = useSafeAreaInsets();
return (
<View style={{ flex: 1 }}>
{/* Your content */}
<FloatingActionButton
icon={{ ios: 'pencil', android: 'edit' }}
label="Compose"
onPress={() => console.log('Compose')}
// The app places the button: bottom end, clear of the safe area
style={{ position: 'absolute', right: 16, bottom: insets.bottom + 16 }}
/>
</View>
);
}
FloatingToolbar
import { Button, FloatingToolbar } from 'react-native-platform-components';
import { View } from 'react-native';
export function Example() {
return (
<View style={{ flex: 1 }}>
{/* Content the toolbar floats over */}
<FloatingToolbar style={{ position: 'absolute', bottom: 24 }}>
<Button
icon={{
ios: { type: 'sfSymbol', name: 'square.and.arrow.up' },
android: { type: 'drawable', name: 'share' },
}}
variant="text"
accessibilityLabel="Share"
onPress={() => console.log('share')}
/>
<Button
icon={{
ios: { type: 'sfSymbol', name: 'trash' },
android: { type: 'drawable', name: 'delete' },
}}
variant="text"
accessibilityLabel="Delete"
onPress={() => console.log('delete')}
/>
<Button label="Send" variant="tonal" onPress={() => console.log('send')} />
</FloatingToolbar>
</View>
);
}
GlassDisclosure
import { GlassDisclosure } from 'react-native-platform-components';
import { Switch, Text, View } from 'react-native';
import { useState } from 'react';
export function Example() {
const [open, setOpen] = useState(false);
const [notify, setNotify] = useState(true);
return (
<View style={{ flex: 1 }}>
{/* The screen's content */}
{/* Last, so it covers the screen */}
<GlassDisclosure
style={{ paddingTop: 60, paddingHorizontal: 12 }}
expanded={open}
onExpandedChange={setOpen}
title="concept-plans"
subtitle="5 members • 3 tabs"
>
<View style={{ flexDirection: 'row', alignItems: 'center', padding: 8 }}>
<Text style={{ flex: 1 }}>Notifications</Text>
<Switch value={notify} onValueChange={setNotify} />
</View>
</GlassDisclosure>
</View>
);
}
ProgressIndicator
import { ProgressIndicator } from 'react-native-platform-components';
import { View } from 'react-native';
export function Example({ uploaded, total, step }: { uploaded: number; total: number; step: number }) {
return (
<View style={{ gap: 24, padding: 16 }}>
{/* Determinate: animates as the value changes */}
<ProgressIndicator progress={uploaded / total} accessibilityLabel="Uploading" />
{/* Step progress: one native bar per step */}
<ProgressIndicator progress={step / 4} segments={4} accessibilityLabel="Setup" />
{/* Indeterminate spinner, and Material 3 Expressive's loading indicator */}
<View style={{ flexDirection: 'row', gap: 24 }}>
<ProgressIndicator variant="circular" accessibilityLabel="Loading" />
<ProgressIndicator variant="loading" accessibilityLabel="Loading" />
</View>
{/* Android: the Expressive wavy bar */}
<ProgressIndicator progress={0.6} android={{ wavy: true }} />
</View>
);
}
LiquidGlass
import {
LiquidGlass,
isLiquidGlassSupported,
} from 'react-native-platform-components';
import { View, Text, Image } from 'react-native';
export function Example() {
return (
<View style={{ flex: 1 }}>
{/* Background content */}
<Image
source={{ uri: 'https://example.com/photo.jpg' }}
style={{ flex: 1 }}
/>
{/* Glass effect overlay */}
<LiquidGlass
style={{
position: 'absolute',
top: 50,
left: 20,
right: 20,
padding: 20,
}}
cornerRadius={20}
ios={{
effect: 'regular',
interactive: true,
colorScheme: 'system',
}}
android={{
fallbackBackgroundColor: '#FFFFFF80',
}}
>
<Text style={{ fontSize: 18, fontWeight: '600' }}>
{isLiquidGlassSupported ? 'Glass Effect!' : 'Fallback View'}
</Text>
</LiquidGlass>
</View>
);
}