<Box h="$32" w="$72"><FormControlsize="md"isDisabled={false}isInvalid={false}isReadOnly={false}isRequired={false}><FormControlLabel mb="$1"><FormControlLabelText>Password</FormControlLabelText></FormControlLabel><Input><InputField type="password" defaultValue="12345" placeholder="password" /></Input><FormControlHelper><FormControlHelperText>Must be at least 6 characters.</FormControlHelperText></FormControlHelper><FormControlError><FormControlErrorIcon as={AlertCircleIcon} /><FormControlErrorText>At least 6 characters are required.</FormControlErrorText></FormControlError></FormControl></Box>
import { FormControl } from '@gluestack-ui/themed';
export default () => (<FormControl><FormControlLabel><FormControlLabelText /></FormControlLabel><FormControlHelper><FormControlHelperText /></FormControlHelper><FormControlError><FormControlErrorIcon /><FormControlErrorText /></FormControlError></FormControl>)
Prop | Type | Default | Description |
---|---|---|---|
size | 'sm' | 'md' | 'lg' | 'sm' | Sets the size of the FormControl children. |
isInvalid | bool | false | When true, invalid state. |
isRequired | bool | false | If true, astrick gets activated. |
isDisabled | bool | false | Disabled state true. |
isReadOnly | bool | false | To manually set read-only state. |
isDisabled | bool | false | To manually set disable to the FormControl. |
Sx Prop | Description |
---|---|
_labelText | Prop to style FormControlLabelText Component |
_helperText | Prop to style FormControlHelperText Component |
_errorText | Prop to style FormControlErrorText Component |
_labelAstrick | Prop to style FormControlLabelAstrick Component |
Sx Prop | Description |
---|---|
_labelText | Prop to style FormControlLabelText Component |
Name | Value | Default |
---|---|---|
size | sm | md | lg | md |
<FormControl minWidth="$80"><FormControlLabel><FormControlLabelText>Name</FormControlLabelText></FormControlLabel><Input><InputField /></Input><FormControlHelper><FormControlHelperText>What would you like people to call you?</FormControlHelperText></FormControlHelper></FormControl>
<FormControl><FormControlLabel><FormControlLabelText>Favourite fruit</FormControlLabelText></FormControlLabel><RadioGroup my="$2"><VStack space="sm"><Radio size="sm" value="Mango"><RadioIndicator mr="$2"><RadioIcon><CircleIcon /></RadioIcon></RadioIndicator><RadioLabel>Mango</RadioLabel></Radio><Radio size="sm" value="Apple"><RadioIndicator mr="$2"><RadioIcon><CircleIcon /></RadioIcon></RadioIndicator><RadioLabel>Apple</RadioLabel></Radio><Radio size="sm" value="Orange"><RadioIndicator mr="$2"><RadioIcon><CircleIcon /></RadioIcon></RadioIndicator><RadioLabel>Orange</RadioLabel></Radio></VStack></RadioGroup><FormControlHelper><FormControlHelperText>Choose the fruit you like the most</FormControlHelperText></FormControlHelper></FormControl>
<FormControl><FormControlLabel><FormControlLabelText>Sign up for newsletters</FormControlLabelText></FormControlLabel><CheckboxGroup my="$2"><VStack space="sm"><Checkbox size="sm" value="Mango"><CheckboxIndicator mr="$2"><CheckboxIcon><CheckIcon /></CheckboxIcon></CheckboxIndicator><CheckboxLabel>Daily Bits</CheckboxLabel></Checkbox><Checkbox size="sm" value="Apple"><CheckboxIndicator mr="$2"><CheckboxIcon><CheckIcon /></CheckboxIcon></CheckboxIndicator><CheckboxLabel>Event Updates</CheckboxLabel></Checkbox><Checkbox size="sm" value="Orange"><CheckboxIndicator mr="$2"><CheckboxIcon><CheckIcon /></CheckboxIcon></CheckboxIndicator><CheckboxLabel>Sponsorship</CheckboxLabel></Checkbox></VStack></CheckboxGroup><FormControlHelper><FormControlHelperText>Subscribe to newsletters for updates</FormControlHelperText></FormControlHelper></FormControl>
<FormControl><FormControlLabel><FormControlLabelText>Comment</FormControlLabelText></FormControlLabel><Textarea><TextareaInput /></Textarea><FormControlHelper><FormControlHelperText>Type your comment above</FormControlHelperText></FormControlHelper></FormControl>
<HStack space="md"><FormControl><Input><InputField placeholder="Username" /></Input></FormControl><FormControl><Select><SelectTrigger><SelectInput placeholder="Country" /><SelectIcon mr="$3"><Icon as={ChevronDownIcon} /></SelectIcon></SelectTrigger><SelectPortal><SelectBackdrop /><SelectContent><SelectDragIndicatorWrapper><SelectDragIndicator /></SelectDragIndicatorWrapper><SelectItem label="India" value="India" /><SelectItem label="Sri Lanka" value="Sri Lanka" /><SelectItem label="Uganda" value="Uganda" /><SelectItem label="Japan" value="Japan" /></SelectContent></SelectPortal></Select></FormControl><FormControl><Button bg="$darkBlue600"><ButtonText fontSize="$sm" fontWeight="$medium">Next</ButtonText></Button></FormControl></HStack>
function App() {const [showModal, setShowModal] = useState(false)return (<Center h={500}><Buttonpy="$2.5"px="$3"bg="$darkBlue600"onPress={() => {setShowModal(true)}}><ButtonText>Change Settings</ButtonText></Button><ModalisOpen={showModal}onClose={() => {setShowModal(false)}}><ModalBackdrop /><ModalContent maxWidth="$96"><ModalBody p="$5"><VStack space="xs" mb="$4"><Heading>Change Settings</Heading><Text size="sm">Make modifications to the settings with ease.</Text></VStack><VStack py="$2" space="xl"><FormControl><FormControlLabel><FormControlLabelText>Name</FormControlLabelText></FormControlLabel><Input><InputField value="Wade Warren" /></Input></FormControl><FormControl><FormControlLabel><FormControlLabelText>Email</FormControlLabelText></FormControlLabel><Input><InputField value="wadewarren@sample.com" /></Input></FormControl><FormControl><FormControlLabel><FormControlLabelText>Volume</FormControlLabelText></FormControlLabel><Slider defaultValue={60} sliderTrackHeight={4}><SliderTrack><SliderFilledTrack /></SliderTrack><SliderThumb /></Slider></FormControl><FormControl><HStack space="sm"><Switch size="sm" /><FormControlLabelText>Dark Mode</FormControlLabelText></HStack></FormControl></VStack><Buttonmt="$4"onPress={() => {setShowModal(false)}}><ButtonText>Save Changes</ButtonText></Button></ModalBody></ModalContent></Modal></Center>)}
<FormControl isInvalid><FormControlLabel><FormControlLabelText>Which time slot works best for you?</FormControlLabelText></FormControlLabel><RadioGroup my="$2"><VStack space="sm"><Radio size="sm" value="Mango"><RadioIndicator mr="$2"><RadioIcon><CircleIcon /></RadioIcon></RadioIndicator><RadioLabel>Monday</RadioLabel></Radio><Radio size="sm" value="Apple"><RadioIndicator mr="$2"><RadioIcon><CircleIcon /></RadioIcon></RadioIndicator><RadioLabel>Tuesday</RadioLabel></Radio><Radio size="sm" value="Orange"><RadioIndicator mr="$2"><RadioIcon><CircleIcon /></RadioIcon></RadioIndicator><RadioLabel>Wednesday</RadioLabel></Radio></VStack></RadioGroup><FormControlError><FormControlErrorIcon as={AlertCircleIcon} /><FormControlErrorText>Choose one time slot for the meeting</FormControlErrorText></FormControlError></FormControl>
<HStack><FormControl><Button action="negative" mr="$4"><ButtonText>Delete</ButtonText></Button></FormControl><FormControl><Button variant="outline" action="secondary"><ButtonText>Cancel</ButtonText></Button></FormControl></HStack>