feat: ✨ add new className props in SimpleSwitch component

This commit is contained in:
Alexis Gousseau 2025-12-15 15:50:46 +01:00
parent 49ac5d540d
commit 8ff23cc1f9

View file

@ -13,6 +13,7 @@ type SimpleSwitchProps = {
label?: string;
leftHelper?: string;
rightHelper?: string;
className?: string|null;
required?: boolean;
disabled?: boolean;
parentErrors?: Record<string, string> | null,
@ -26,6 +27,7 @@ export default function SimpleSwitch({
label,
leftHelper,
rightHelper,
className = null,
required = false,
disabled = false,
parentErrors = null,
@ -35,13 +37,14 @@ export default function SimpleSwitch({
const localErrors = parentErrors ?? errors;
return (
<div className="flex flex-col items-start w-fit gap-1.5">
<div className={`flex flex-col items-start w-fit gap-1.5 ${className}`}>
{label && (<Label htmlFor={name}>{label + (required ? " *" : "")}</Label>)}
<div className="flex items-center gap-3">
{leftHelper && (
<small>{leftHelper}</small>
)}
<Switch
id={name}
name={name}
onCheckedChange={(value) => setData(name, value)}
required={required}