Toggle

A smooth toggle switch with 6 visual variants, 3 sizes, optional label, and customizable color.

Import

import { Toggle } from "@igorao79/uivix";

Playground

All Variants

All Sizes

Usage

const [enabled, setEnabled] = useState(false);

<Toggle
  variant="ios"
  checked={enabled}
  onChange={(e) => setEnabled(e.target.checked)}
  label="Dark mode"
  size="md"
/>

Props

PropTypeDefaultDescription
variant"default" | "ios" | "material" | "outline" | "glow" | "pill""default"Visual style variant of the toggle
size"sm" | "md" | "lg""md"Size of the toggle switch
colorstring"#8b5cf6"Active background color
labelstring-Label text displayed beside the toggle
checkedbooleanfalseWhether the toggle is on
disabledbooleanfalseWhether the toggle is disabled
onChange(e: ChangeEvent) => void-Called when the toggle value changes
classNamestring-Additional CSS classes