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

Function Switch

starters/tailwind/src/Switch.tsx:59–80  ·  view source on GitHub ↗
({children, ...props}: SwitchProps)

Source from the content-addressed store, hash-verified

57});
58
59export function Switch({children, ...props}: SwitchProps) {
60 return (
61 <SwitchField {...props} className="flex flex-col gap-1 group">
62 <SwitchButton
63 className={composeTailwindRenderProps(
64 props.className,
65 'group relative flex gap-2 items-center text-neutral-800 disabled:text-neutral-300 dark:text-neutral-200 dark:disabled:text-neutral-600 forced-colors:disabled:text-[GrayText] text-sm transition [-webkit-tap-highlight-color:transparent]'
66 )}>
67 {renderProps => (
68 <>
69 <div className={track(renderProps)}>
70 <span className={handle(renderProps)} />
71 </div>
72 {children}
73 </>
74 )}
75 </SwitchButton>
76 {props.description && <Description>{props.description}</Description>}
77 <FieldError>{props.errorMessage}</FieldError>
78 </SwitchField>
79 );
80}

Callers

nothing calls this directly

Calls 2

trackFunction · 0.85

Tested by

no test coverage detected