Checkbox
A checkbox allows a user to select multiple items from a list of individual items, or to mark one individual item as selected.
isIndeterminate
isDisabled
Selection
Use the isSelected
or defaultSelected
prop to set the selection state, and onChange
to handle selection changes. The isIndeterminate
prop overrides the selection state regardless of user interaction.
You are unsubscribed
isIndeterminate
Forms
Use the name
and value
props to submit the checkbox to the server. Set the isRequired
prop to validate the user selects the checkbox, or implement custom client or server-side validation. See the Forms guide to learn more.
import {Checkbox} from './Checkbox';
import {Button} from './Button';
import {Form} from 'react-aria-components';
<Form>
<Checkbox
name="terms"
value="agree"
isRequired>
I agree to the terms
</Checkbox>
<Button type="submit" style={{marginTop: 8}}>Submit</Button>
</Form>