Skip to content
Snippets Groups Projects
Commit 62a0ff25 authored by Vink, S.A. (Sjoerd)'s avatar Vink, S.A. (Sjoerd)
Browse files

fix(booleanInput): same style as dropdown text

parent ce7773d7
Loading
Pipeline #138903 passed
......@@ -78,6 +78,11 @@ type BooleanProps = {
value: boolean;
tooltip?: string;
onChange?: (value: boolean) => void;
size?: 'xs' | 'sm' | 'md' | 'xl';
info?: string;
required?: boolean;
className?: string;
inline?: boolean;
};
type RadioProps = {
......@@ -407,23 +412,30 @@ export const CheckboxInput = ({ label, value, options, onChange, tooltip }: Chec
);
};
export const BooleanInput = ({ label, value, onChange, tooltip }: BooleanProps) => {
export const BooleanInput = ({ label, value, onChange, tooltip, info, size, required, className }: BooleanProps) => {
return (
<Tooltip>
<TooltipTrigger>
<label className={`label cursor-pointer w-fit gap-2 px-0 py-1`}>
<span className="text-sm">{label}</span>
<input
type="checkbox"
checked={value}
onChange={(event) => {
if (onChange) {
onChange(event.target.checked);
}
}}
className="checkbox checkbox-xs"
/>
</label>
<TooltipTrigger className={className + 'w-full flex justify-between'}>
{label && (
<label className="label p-0">
<span
className={`text-${size} text-left truncate font-medium text-secondary-700 ${required && "after:content-['*'] after:ml-0.5 after:text-danger-500"}`}
>
{label}
</span>
{info && <Info tooltip={info} />}
</label>
)}
<input
type="checkbox"
checked={value}
onChange={(event) => {
if (onChange) {
onChange(event.target.checked);
}
}}
className="checkbox checkbox-xs"
/>
</TooltipTrigger>
{tooltip && <TooltipContent>{tooltip}</TooltipContent>}
</Tooltip>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment