GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

No menu could be recovered. Follow the blue links in the page.

This view

  • Original page
  • New address

GeezerVison is showing docs.nativebase.io — Select | NativeBase | Universal Components for React and React Native

Select | NativeBase | Universal Components for React and React Native

NativeBase
3.4.x
🎉 Prompt to React Native UI
→
Search
⌘
K
Hire us
NativeBase
Introduction
Getting Started
Installation
Setup NativeBase Provider
Migration
Upgrading to v3
Upgrading to 3.2.0 from 3.x
Upgrading to 3.4.0 from 3.3.x
Components Migration
ActionSheet
Badge
Button
Card
Checkbox
DatePicker
DeckSwiper
Drawer
FABs
FooterTab
Form
Header
Icon
Layout
Picker
Radio Button
Searchbar
Segment
Spinner
SwipeList
Tabs
Thumbnail
Toast
Typography
Resources
Contribution
Creating a Universal App with NativeBase and Solito
Core Concepts
Utility First
Utility Props Specificity
Design Tokens
Pseudo Props: Overview
Pseudo Props: Dos & Don'ts
Internal Pseudo Props
Responsive
Features
Utility Props
Color mode (Dark Mode)
NativeBase Factory
SafeAreaView Props
Strict Mode
Accessibility
Theme
Default Theme
Customizing Theme
Customizing Fonts
Customizing Components
Making components dark mode compatible
Breakpoints
Using Theme
TypeScript
Layout
AspectRatio
Box
Center
Container
Flex
HStack / Row
Stack
VStack / Column
ZStack
Forms
Button
Pressable
Checkbox
FormControl
IconButton
Input
Link
Radio
Select
Slider
Switch
TextArea
Data Display
Badge
Divider
Feedback
Alert
Progress
Skeleton
Spinner
Toast
Typography
Text
Heading
Overlay
AlertDialog
Menu
Modal
Popover
Tooltip
Disclosure
ActionSheet
Media and Icons
Avatar
Icon
Image
Transition
PresenceTransition
Slide
Stagger
Others
Fab
Hidden
ReactNative Components
ScrollView
View
KeyboardAvoidingView
StatusBar
FlatList
SectionList
Hooks
useDisclose
useBreakpointValue
useClipboard
useMediaQuery
useTheme
useToken
useColorMode
useColorModeValue
useContrastText
useAccessibleColors
Examples
Todo-List
Kitchen Sink
Recipes
Designs
AppBar
Card
Drawer Navigation
Tab View
Swipe List
Forms
Form with Validation
Login/Signup Forms
SearchBar
Layout
App Drawer
Footer
More
Changelog
Testing
FAQ's
More Props
If you are starting a new project, please try gluestack-ui for better performance and new design.
Select
Select creates a dropdown list of items with the selected item in closed view.
Show Code
Playground
const Example = () => {
let [service, setService] = React.useState("");
return <VStack alignItems="center" space={4}>
<Select shadow={2} selectedValue={service} minWidth="200" accessibilityLabel="Choose Service" placeholder="Choose Service" _selectedItem={{
bg: "teal.600",
endIcon: <CheckIcon size="5" />
}} _light={{
bg: "coolGray.100",
_hover: {
bg: "coolGray.200"
},
_focus: {
bg: "coolGray.200:alpha.70"
}
}} _dark={{
bg: "coolGray.800",
_hover: {
bg: "coolGray.900"
},
_focus: {
bg: "coolGray.900:alpha.70"
}
}} onValueChange={itemValue => setService(itemValue)}>
<Select.Item shadow={2} label="UX Research" value="ux" />
<Select.Item shadow={2} label="Web Development" value="web" />
<Select.Item shadow={2} label="Cross Platform Development" value="cross" />
<Select.Item shadow={2} label="UI Designing" value="ui" />
<Select.Item shadow={2} label="Backend Development" value="backend" />
</Select>
</VStack>;
};
Import
Copy
import { Select } from "native-base";
Examples
Basic
Playground
const Example = () => {
const [service, setService] = React.useState("");
return <Center>
<Box maxW="300">
<Select selectedValue={service} minWidth="200" accessibilityLabel="Choose Service" placeholder="Choose Service" _selectedItem={{
bg: "teal.600",
endIcon: <CheckIcon size="5" />
}} mt={1} onValueChange={itemValue => setService(itemValue)}>
<Select.Item label="UX Research" value="ux" />
<Select.Item label="Web Development" value="web" />
<Select.Item label="Cross Platform Development" value="cross" />
<Select.Item label="UI Designing" value="ui" />
<Select.Item label="Backend Development" value="backend" />
</Select>
</Box>
</Center>;
};
FormControlled
Playground
const Example = () => {
return <Center>
<FormControl w="3/4" maxW="300" isRequired isInvalid>
<FormControl.Label>Choose service</FormControl.Label>
<Select minWidth="200" accessibilityLabel="Choose Service" placeholder="Choose Service" _selectedItem={{
bg: "teal.600",
endIcon: <CheckIcon size={5} />
}} mt="1">
<Select.Item label="UX Research" value="ux" />
<Select.Item label="Web Development" value="web" />
<Select.Item label="Cross Platform Development" value="cross" />
<Select.Item label="UI Designing" value="ui" />
<Select.Item label="Backend Development" value="backend" />
</Select>
<FormControl.ErrorMessage leftIcon={<WarningOutlineIcon size="xs" />}>
Please make a selection!
</FormControl.ErrorMessage>
</FormControl>
</Center>;
};
Select
Props
Select implements
View
,
SafeAreaProps
,
PlatformProps
,
FlexProps
,
LayoutProps
,
BorderProps
,
TypographyProps
,
ShadowProps
,
PositionProps
placeholder
The placeholder that describes the Select.
Type: string
color
The Selected Item text color.
Type: ResponsiveValue<"gray.300" | "muted.50" | "muted.800" | "text.500" | "text.400" | "muted.500" | "text.900" | "muted.200" | "muted.300" | "muted.400" | "text.50" | "text.600" | "muted.700" | ... 342 more ... | "tertiary.900">
placeholderTextColor
The placeholder text color
Type: ResponsiveValue<"gray.300" | "muted.50" | "muted.800" | "text.500" | "text.400" | "muted.500" | "text.900" | "muted.200" | "muted.300" | "muted.400" | "text.50" | "text.600" | "muted.700" | ... 342 more ... | "tertiary.900">
_item
Item props passed here will be passed to each Select.Item component.
Type: Partial<IButtonProps>
_selectedItem
Item props passed here will be passed to the selected Select.Item component.
Type: Partial<IButtonProps>
selectedValue
Currently selected value. Useful for controlling the Select state
Type: string
defaultValue
Default selected value.
Type: string
onValueChange
Callback to be invoked when Select value is changed
Type: (itemValue: string) => void
isDisabled
Whether Select is disabled
Type: boolean
isHovered
Whether Select is hovered
Type: boolean
isFocused
Whether Select is focused
Type: boolean
isFocusVisible
If true, the focus ring of select will be visible.
Type: boolean
dropdownIcon
If given, updates the dropdown Icon
Type: Element
dropdownOpenIcon
If given, updates the dropdown Icon when opened
Type: Element
dropdownCloseIcon
If given, updates the dropdown Icon when closed
Type: Element
variant
Variant of the Select
Type: "outline" | "unstyled" | "rounded" | "filled" | "underlined"
Default: outline
onOpen
Callback to be invoked when Select Dropdown or BottomSheet is opened.
Type: (nativeEvent: any) => void
onClose
Callback to be invoked when Select Dropdown or BottomSheet is closed.
Type: (nativeEvent: any) => void
_actionSheet
props to be passed to underlying ActionSheet. Select uses ActionSheet underneath.
Type: Partial<IActionsheetProps>
_actionSheetContent
props to be passed to underlying ActionSheet.Content. Select uses ActionSheet underneath.
Type: Partial<IActionsheetContentProps>
_actionSheetBody
props to be passed to underlying Flatlist in ActionSheet.Content.
Type: Partial<IFlatListProps<any>>
wrapperRef
Ref to be attached to the Select wrapper
Type: MutableRefObject<any>
Select.Item
Props
SelectItem implements
Pressable
,
View
,
FlexProps
,
ColorProps
,
LayoutProps
,
BorderProps
,
TypographyProps
,
ShadowProps
,
PositionProps
,
BackgroundProps
,
PlatformProps
label
The label which will be displayed.
Type: string
value
The value to be used for the item. This is the value that will be returned on form submission.
Type: string
Styling
NativeBase ships with a default theme for each component. Check out the default theme of the select
here
.
Info: We can easily extend the select component theme using extendTheme function as described in the documentation
here
.
Accessibility
use native variant. Accessibility improvements on styled variant is in-progress.
Previous
Radio
Next
Slider
Quick Nav
Import
Examples
Basic
FormControlled
Select
Props
Select.Item
Props
Styling
Accessibility
MadeWithNativeBase
gluestack-ui
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.