MCPcopy Create free account
hub / github.com/adobe/react-spectrum / Checkbox

Function Checkbox

starters/tailwind/src/Checkbox.tsx:52–80  ·  view source on GitHub ↗
(props: CheckboxProps)

Source from the content-addressed store, hash-verified

50}
51
52export function Checkbox(props: CheckboxProps) {
53 return (
54 <CheckboxField {...props} className="flex flex-col gap-1 group">
55 <CheckboxButton
56 className={composeRenderProps(props.className, (className, renderProps) =>
57 checkboxStyles({...renderProps, className})
58 )}>
59 {composeRenderProps(
60 props.children,
61 (children, {isSelected, isIndeterminate, ...renderProps}) => (
62 <>
63 <div
64 className={boxStyles({isSelected: isSelected || isIndeterminate, ...renderProps})}>
65 {isIndeterminate ? (
66 <Minus aria-hidden className={iconStyles} />
67 ) : isSelected ? (
68 <Check aria-hidden className={iconStyles} />
69 ) : null}
70 </div>
71 {children}
72 </>
73 )
74 )}
75 </CheckboxButton>
76 {props.description && <Description className="ms-6.5">{props.description}</Description>}
77 <FieldError className="ms-6.5">{props.errorMessage}</FieldError>
78 </CheckboxField>
79 );
80}

Callers

nothing calls this directly

Calls 1

composeRenderPropsFunction · 0.85

Tested by

no test coverage detected