Socket
Book a DemoInstallSign in
Socket

@aristobyte-ui/switch

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aristobyte-ui/switch

A fully typed, customizable Switch/toggle component for React with multiple sizes, variants, label alignments, and optional icons. Built to integrate seamlessly with AristoByteUI design tokens and SCSS modules.

1.0.35
latest
Source
npmnpm
Version published
Weekly downloads
2K
324.35%
Maintainers
1
Weekly downloads
 
Created
Source

@aristobyte-ui/switch

TypeScript TurboRepo ESLint License AristoByte UI Node.js >=20.17.0 Yarn >=1.22 NPM >=10.8

A highly flexible and type-safe Switch component for React with multiple sizes, variants, and label alignment options.

📦 Installation

# Install via Yarn
yarn add -D @aristobyte-ui/switch

# Or via npm
npm install -D @aristobyte-ui/switch

# Or via pnpm
pnpm add -D @aristobyte-ui/switch

🛠 Usage

import { Switch } from "@aristobyte-ui/switch";

export const Demo = () => (
  <Switch
    label="Enable notifications"
    alignLabel="horizontal"
    switchSize="md"
    variant="primary"
    checked={true}
    onChange={() => console.log("Toggled!")}
  />
);

📂 Presets Available

alignLabel: "horizontal" | "vertical" (default: "vertical")

switchSize: "xsm" | "sm" | "md" | "lg" | "xlg" (default: "md")

variant: "default" | "primary" | "secondary" | "success" | "error" | "warning" (default: "default")

trackIcon & thumbIcon: Optional React components for custom icons

disabled: Boolean flag to disable switch

🔧 Example in a Package

<Switch
  label="Dark Mode"
  switchSize="lg"
  variant="secondary"
  trackIcon={{ checked: CheckIcon, unchecked: CloseIcon }}
  thumbIcon={StarIcon}
  checked={false}
/>

📊 Why This Matters

  • Performance-first: Lightweight CSS transitions ensure smooth toggling with zero layout thrashing.
  • Fully typed: TypeScript-first API for predictable integration and IDE autocomplete.
  • AristoByteUI ready: Integrates seamlessly with design tokens and SCSS modules.
  • Flexible: Supports multiple sizes, label alignments, variants, and custom icons.

🏆 Philosophy

  • Modular architecture: Switch component is fully composable.
  • Declarative styling: SCSS modules keep styles maintainable and scoped.
  • Strict typing & runtime flexibility: Props fully typed while allowing runtime overrides.
  • Developer experience optimized: Easy to use with predictable behavior and minimal boilerplate.

📜 License

MIT © AristoByte

🛡 Shields Showcase

Keywords

switch

FAQs

Package last updated on 03 Sep 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.