Skip to content

Commit

Permalink
add default value for Toogle size
Browse files Browse the repository at this point in the history
  • Loading branch information
aralovelace committed Dec 5, 2024
1 parent 3d65468 commit 696346c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/core/Toggle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import cn from "./utils/cn";

type ToggleProps = {
id: string;
size?: string;
size?: "default" | "small";
label?: string;
className?: string;
} & React.ButtonHTMLAttributes<HTMLButtonElement>;
Expand All @@ -18,7 +18,9 @@ const Toggle: React.FC<ToggleProps> = ({
}) => {
const rootSize = size === "small" ? "w-[42px] h-[24px]" : "w-[56px] h-32";
const thumbSize =
size === "small" ? "w-[21px] h-[21px] translate-x-1 data-[state=checked]:translate-x-[20px]" : "h-[28px] w-[28px] translate-x-2 data-[state=checked]:translate-x-[26px]";
size === "small"
? "w-[21px] h-[21px] translate-x-1 data-[state=checked]:translate-x-[20px]"
: "h-[28px] w-[28px] translate-x-2 data-[state=checked]:translate-x-[26px]";

return (
<div className="flex items-center">
Expand Down

0 comments on commit 696346c

Please sign in to comment.