({children, orientation = 'vertical', ...props}: CheckboxGroupProps)
| 28 | let CheckboxGroupContext = React.createContext<CheckboxGroupState | null>(null); |
| 29 | |
| 30 | export function CheckboxGroup({children, orientation = 'vertical', ...props}: CheckboxGroupProps) { |
| 31 | // useCheckboxGroupState manages the selected values for the group. |
| 32 | let state = useCheckboxGroupState(props); |
| 33 | let {groupProps, labelProps} = useCheckboxGroup(props, state); |
| 34 | |
| 35 | return ( |
| 36 | <div |
| 37 | {...groupProps} |
| 38 | className="react-aria-CheckboxGroup" |
| 39 | data-orientation={orientation} |
| 40 | data-readonly={state.isReadOnly || undefined} |
| 41 | data-invalid={state.isInvalid || undefined} |
| 42 | data-disabled={props.isDisabled || undefined}> |
| 43 | {props.label && ( |
| 44 | <span {...labelProps} className="react-aria-Label"> |
| 45 | {props.label} |
| 46 | </span> |
| 47 | )} |
| 48 | <div className="checkbox-items"> |
| 49 | <CheckboxGroupContext.Provider value={state}>{children}</CheckboxGroupContext.Provider> |
| 50 | </div> |
| 51 | </div> |
| 52 | ); |
| 53 | } |
| 54 | |
| 55 | export function Checkbox(props: AriaCheckboxGroupItemProps) { |
| 56 | let state = React.useContext(CheckboxGroupContext)!; |
nothing calls this directly
no test coverage detected