function Example() {
const [checked, setChecked] = useState(false);
const CustomHandle = ({ checked, ...props }: SlideButtonHandleProps) => (
<Pressable
{...props}
accessibilityLabel="Demo button"
accessibilityRole="button"
background={checked ? 'bgPositive' : 'bgNegative'}
borderRadius={300}
width="100%"
>
<HStack alignItems="center" height="100%" justifyContent="center" width="100%">
<HStack height="100%" pin="right" alignItems="center" padding={2}>
<TextLabel1>➡️</TextLabel1>
</HStack>
</HStack>
</Pressable>
);
const CustomBackground = ({ checked, ...props }: SlideButtonBackgroundProps) => (
<HStack
{...props}
bordered
alignItems="center"
background="bgSecondary"
borderColor={checked ? 'fgPositive' : 'fgNegative'}
borderRadius={300}
height="100%"
justifyContent="center"
width="100%"
>
<TextHeadline>Slide me</TextHeadline>
</HStack>
);
return (
<SlideButton
uncheckedLabel="Swipe to confirm"
checkedLabel="Confirming..."
checked={checked}
onChange={setChecked}
SlideButtonBackgroundComponent={CustomBackground}
SlideButtonHandleComponent={CustomHandle}
height={50}
/>
);
}