Checkbox

An input that lets users select one or more options from a limited number of choices. Each selection is independent (with some exceptions).

React

Is new design vision part implemented using new tokens?

Up to date

Resources

Example


                                                                                                                                                        
                                                                                                                                                        
                                                                                                                                                            import { CheckboxGroup } from '@optimus-web/core';
                                                                                                                                                        
                                                                                                                                                        const MyCheckboxGroupComponent = () => {
                                                                                                                                                            const [groupValues, setGroupValues] = useState(values);
                                                                                                                                                            const handleChange = (_event: React.SyntheticEvent<HTMLElement>, newValues: InputValue[]) => {
                                                                                                                                                                setGroupValues(newValues);
                                                                                                                                                            };
                                                                                                                                                        
                                                                                                                                                            return <CheckboxGroup values={groupValues} onChange={handleChange} label='Fruits' options={[
                                                                                                                                                                        { name: 'fruit', value: 'apple', label: 'Apple' },
                                                                                                                                                                        { name: 'fruit', value: 'strawberry', label: 'Strawberry' },
                                                                                                                                                                        { name: 'fruit', value: 'lemon', label: 'Lemon' },
                                                                                                                                                                    ]}/>;
                                                                                                                                                        };
                                                                                                                                                        
                                                                                                                                                            

                                                                                                                                                        
                                                                                                                                                        
                                                                                                                                                            import { Checkbox } from '@optimus-web/core';
                                                                                                                                                        
                                                                                                                                                        const MyCheckboxComponent = () => {
                                                                                                                                                            const [checked, setChecked] = useState<>(false);
                                                                                                                                                        
                                                                                                                                                            return <Checkbox checked={false} value="label" name="checkbox" onChange={(_, true) => setChecked(true)}/>
                                                                                                                                                        }