Checkbox is Dirty Is Not Working #10943
Unanswered
makhdum530
asked this question in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
<Controller
name="isGsts" // Specify the field name
control={control} // Pass the control prop from useForm
defaultValue={false} // Set the default value as needed
render={({ field }) => (
<Switch
value={isGst} // Map the value to the field's value
onChange={(e) => {
setIsGst(!isGst)
}}
import Icon from "@/components/ui/Icon";
const Switch = ({
prevIcon,
nextIcon,
label,
id,
disabled,
value,
onChange,
activeClass = "bg-slate-900 dark:bg-slate-900",
wrapperClass = " ",
labelClass = "text-slate-500 dark:text-slate-400 text-sm leading-6",
badge,
}) => {
return (
<label
className={
flex items-center ${ disabled ? " cursor-not-allowed opacity-50" : "cursor-pointer " }
+"" +
wrapperClass
}
id={id}
>
<div
className={
relative inline-flex h-6 w-[46px] ltr:mr-3 rtl:ml-3 items-center rounded-full transition-all duration-150 ${value ? activeClass : "bg-secondary-500"}
}>
{badge && value && (
{prevIcon ? (
) : (
on
)}
)}
{badge && !value && (
{nextIcon ? (
) : (
Off
)}
)}
);
};
export default Switch;
Beta Was this translation helpful? Give feedback.
All reactions