Loading
Loading
Loading
mobile footer

Build the Interaction Layer Your Website is Missing.

Browse All EffectsBrowse All EffectsBrowse All EffectsUpgrade to ProUpgrade to ProUpgrade to Pro

80+ effects free, forever. No credit card.

© 2026 Hyperiux. All Rights Reserved.

AI Component CatalogueHey AI, Learn About Us
Platform

Vault

  • Documentation
  • Pricing
  • Blog
  • Community
  • NPM
  • MCP

Categories

  • All Effects
  • WebGL
  • Text
  • Backgrounds
  • Buttons
  • Carousels
  • Scroll
  • Components
  • Navigation
  • Cursor
  • Transitions
  • Loaders

Documents

  • Introduction
  • Installation
  • CLI
  • Dependencies
  • License

Legal

  • License Agreement
  • Terms of Service
  • Privacy Policy
  • Refund Policy
Socials
  • Twitter / X
  • LinkedIn
  • GitHub
  • Instagram
Contact Us
  • hello@hyperiux.com
New effects, in your inbox

Every new drop, plus the occasional behind-the-scenes build. No spam. Unsubscribe anytime.

Loading
Home/Switch Component

Switch Component

An animated toggle switch with elastic press feedback, Apple-style dragging, spring-based movement, and customisable on/off states for modern interfaces.

@base-ui/reactmotiontailwind-merge
DemoDemoDemo

Tune the Real Props

Overview

Switch adds tactile feedback to a standard toggle. The Elastic mode compresses the handle on press, while the Apple mode widens it and lets users drag it between on and off, both settling with a controlled spring. Optional I/O marks add an extra state cue.

Use it for settings that switch on or off immediately, such as notifications, Wi-Fi, auto-updates, and privacy options. The animation should make the control feel responsive, never delay or hide the result.


Theme and Interaction Customisation

Adjust size, roundness, label position, and on-state colour, including semantic success, info, warning, and destructive colours, or an iOS-style green in Apple mode. Interaction settings cover Elastic or Apple mode, press squeeze, duration, and spring bounce.


Example Production Use Case

A SaaS settings page can list notification sounds, auto-updates, and sync options, each with a short description and an Elastic switch that applies the change instantly and reverts if the save fails.

A mobile connectivity panel can use the Apple variant for Wi-Fi and Bluetooth, so users tap or drag the handle just as they would on their phone.

A smart-home dashboard can use larger switches with I/O marks for lights and devices, making each state readable at a glance from across the room.


Best Used For

  • Application settings like auto-updates and sync.
  • Notification preferences.
  • Connectivity controls such as Wi-Fi and Bluetooth.
  • Privacy settings.
  • SaaS workspace feature toggles.
  • Mobile apps with draggable switches.
  • Smart-device controls.

Not For

For one choice among several, use Radio, and for multiple independent form options, use Checkbox.

Actions that need review, like deleting an account or making a payment, shouldn’t happen through a toggle.

If changes only apply after a form is submitted, a checkbox describes that better. An unfamiliar setting always needs a clear label, not just motion and colour.


Performance Budget

Update state immediately and keep handle movement light. Keep press effects short, avoid app-wide updates on every drag event, and always settle on a valid value when a gesture is released or interrupted.


Accessibility and Mobile

Use switch semantics with a stable label, accurate on/off state, Space to toggle, and visible focus. On mobile, give it a comfortable tap target and stop dragging from fighting page scroll, with I/O marks only supplementing real state information. With reduced motion, remove compression, widening, and bounce.


Common Mistakes

  • Using a switch for multi-option decisions.
  • Letting the visual state drift from the real setting.
  • Letting press feedback change the setting on its own.
  • Leaving interrupted gestures in an invalid state.
  • Using excessive bounce.
  • Expecting Apple green without the Apple variant and foreground colour.
  • Showing success when a server update failed.
  • Relying only on colour to show state.
  • Ignoring reduced-motion preferences.

Changelog

v1.0.0

Oct 23, 2026
Initial release

API Reference

PropTypeDefaultDescription
themestringvalorantColour palette for the track, thumb, marks and focus ring. Primary uses its primary colour; Green, Blue, Orange and Rose use its success, info, warning and destructive colours.
modestringdarkLight or dark version of the palette. Starts dark.
variantstringelasticElastic stretches the thumb as it moves; Apple copies the iOS switch.
sizestringxlSize of the switch.
colorstringprimaryTrack colour when the switch is on.
appleGreenbooleanfalseUses iOS green for the on track. Only for the Apple type with On colour set to Foreground.
roundedstringfullCorner radius of the track and thumb.
showMarksbooleanfalseShows on and off marks inside the track.
labelPositionstringtopWhere the label sits relative to the switch.
pressSqueezenumber0.24How much the thumb squashes when pressed (Elastic) or widens (Apple, which stops changing above about 0.27).
durationnumber0.35How long the thumb takes to move, in seconds.
bouncenumber0.3Springiness of the thumb when it lands. 0 means no overshoot.

Questions, Answered.

What is Switch?

Switch is an animated React component for turning a binary setting on or off, with elastic press feedback, Apple-style dragging, spring transitions, and customisable states.

What is the difference between Elastic and Apple switch types?

Elastic compresses the handle when pressed. Apple widens it on press and lets users drag it between positions.

What does the Press squeeze setting do?

It controls how much the handle deforms, compressing in Elastic mode and widening in Apple mode.

Does Switch support Apple-style green?

Yes. Apple green uses an iOS-inspired enabled colour when the Apple variant and foreground colour are selected.

What is the difference between Switch and Checkbox?

Switch represents a setting that turns on or off, often immediately. Checkbox represents a form selection and can be part of a multi-select group.

Is Switch accessible?

It can be, with switch semantics, a stable label, accurate checked state, keyboard activation, and visible focus. Gestures must never be the only way to operate it.

View MoreView More

Request a Custom Animation

Need a custom effect? Tell us what to create.

Related Effects

Explore All EffectsExplore All EffectsExplore All Effects
Dropdown Menu Component
@base-ui/reactclass-variance-authoritygsap

Dropdown Menu Component

Components

Menubar Component
@base-ui/reactlucide-reactmotion

Menubar Component

Components

Bubble Component
@base-ui/reactclass-variance-authoritylucide-react

Bubble Component

Components

All Effects
Featured ComponentsText AnimationsAnimated BackgroundsAnimated ButtonsCarousel EffectsScroll EffectsCreative ComponentsNavigationsCursor EffectsTransitionsLoadersWebGL & 3D Effects
Templates
IntroductionInstallationCLIDependenciesLicense
PricingBlogGithubNPMMCP Doc