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

Function Checkbox

starters/docs/src/Checkbox.tsx:18–44  ·  view source on GitHub ↗
({children, description, errorMessage, ...props}: CheckboxProps)

Source from the content-addressed store, hash-verified

16}
17
18export function Checkbox({children, description, errorMessage, ...props}: CheckboxProps) {
19 return (
20 <CheckboxField {...props}>
21 <CheckboxButton>
22 {({isIndeterminate}) => (
23 <>
24 <div className="indicator">
25 <svg
26 viewBox="0 0 18 18"
27 aria-hidden="true"
28 key={isIndeterminate ? 'indeterminate' : 'check'}>
29 {isIndeterminate ? (
30 <rect x={1} y={7.5} width={16} height={3} />
31 ) : (
32 <polyline points="2 9 7 14 16 4" />
33 )}
34 </svg>
35 </div>
36 {children}
37 </>
38 )}
39 </CheckboxButton>
40 {description && <Description>{description}</Description>}
41 <FieldError>{errorMessage}</FieldError>
42 </CheckboxField>
43 );
44}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected