diff --git a/package.json b/package.json index ce4231e8..b5f71864 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ably/ui", - "version": "15.1.3", + "version": "15.1.4", "description": "Home of the Ably design system library ([design.ably.com](https://design.ably.com)). It provides a showcase, development/test environment and a publishing pipeline for different distributables.", "repository": { "type": "git", diff --git a/src/core/Toggle.tsx b/src/core/Toggle.tsx index f4d9acfd..58e5a131 100644 --- a/src/core/Toggle.tsx +++ b/src/core/Toggle.tsx @@ -4,22 +4,42 @@ import cn from "./utils/cn"; type ToggleProps = { id: string; + size?: "sm" | "lg"; label?: string; className?: string; + onCheckedChange?: (checked: boolean) => void; } & React.ButtonHTMLAttributes; -const Toggle: React.FC = ({ id, label, className, ...props }) => { +const Toggle: React.FC = ({ + id, + size = "lg", + label, + className, + ...props +}) => { + const rootSize = size === "sm" ? "w-[42px] h-24" : "w-[56px] h-32"; + const thumbSize = + size === "sm" + ? "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 (
- + {label ? (