forward switch ref

This commit is contained in:
jeffvli
2025-10-08 21:38:16 -07:00
parent 6b51718c0a
commit 23005ba857
+6 -2
View File
@@ -1,12 +1,14 @@
import type { SwitchProps as MantineSwitchProps } from '@mantine/core';
import { Switch as MantineSwitch } from '@mantine/core';
import { forwardRef, Ref } from 'react';
import styles from './switch.module.css';
type SwitchProps = MantineSwitchProps;
export const Switch = ({ classNames, ...props }: SwitchProps) => {
export const Switch = forwardRef(
({ classNames, ...props }: SwitchProps, ref: Ref<HTMLInputElement>) => {
return (
<MantineSwitch
classNames={{
@@ -16,8 +18,10 @@ export const Switch = ({ classNames, ...props }: SwitchProps) => {
track: styles.track,
...classNames,
}}
ref={ref}
withThumbIndicator={false}
{...props}
/>
);
};
},
);