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

Function Switch

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

Source from the content-addressed store, hash-verified

16}
17
18export function Switch({children, description, errorMessage, ...props}: SwitchProps) {
19 return (
20 <SwitchField {...props}>
21 <SwitchButton>
22 {({isSelected, isDisabled}) => (
23 <>
24 <div className="track indicator">
25 <div
26 data-disabled={isDisabled || undefined}
27 className={isSelected ? 'handle' : 'handle indicator'}
28 />
29 </div>
30 {children}
31 </>
32 )}
33 </SwitchButton>
34 {description && <Description>{description}</Description>}
35 <FieldError>{errorMessage}</FieldError>
36 </SwitchField>
37 );
38}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected