Skip to main content
ExodeUI

EXODEUI DESKTOP

A little space for good ideas.

Choose your platform to get the official ExodeUI installer.

Looking for Intel Mac or other builds? Explore the web studio or check all download options.

Prefer the browser? Try for free in your browser →
UI & States5 min read

Tactile State Machine Toggle Switch

Direct Definition & Architecture

An interactive toggle switch authored in ExodeUI pairs a two-state Boolean machine with elastic squash-and-stretch geometry. As the thumb traverses the track, inertia elongates its horizontal axis before snapping crisply into the active terminal.

Live .bexode800 × 400

Click the switch; try the checked input to reset it.

Live inputs
Download .bexodeDownload .exodeEvents: changeenableddisabled

Technical Specifications

Scene format
One .exode file
Live inputs
checked, label, sublabel, speed, accent
Emitted events
change, enabled, disabled
Motion
Elastic thumb stretch + particle burst

Interaction Phases

UncheckedThumb rests left on the off-colour track.
DraggingThe thumb stretches along its travel axis while the spring catches up.
CheckedThumb settles right; the track fills with the accent colour.
EventEach flip emits change plus enabled or disabled for the host app.

The scene keeps one Idle state. These phases are driven by its inputs and pointer events; the same values appear in the code below.

Use the scene

interactive-toggle.jsx
import { ExodeUICanvas } from 'exodeui';

// interactive-toggle.bexode goes in /public
export function InteractiveToggle() {
  return (
    <ExodeUICanvas
      src="/motion-ui/motion-switch.bexode"
      fit="Layout"
      autoPlay
      interactive
      inputs={{
        checked: true,
        label: 'Realtime Sync',
        sublabel: 'Enable zero-latency vector state synchronization',
        speed: 1,
        accent: '#10b981',
        offColor: '#272732',
        bg: '#090a10',
      }}
      onTrigger={(name) => {
        // fires: 'change', 'enabled', 'disabled'
      }}
      style={{ width: '100%', height: 400 }}
    />
  );
}

This snippet loads /motion-ui/motion-switch.bexode with the same inputs shown in the live stage.

Architectural Breakdown

Traditional UI switches use linear translations that feel static and robotic.

With ExodeUI, the toggle thumb dynamically expands horizontally while in motion to simulate physical inertia, then snaps back to a circle once resting.

State machines guarantee that rapid toggling cannot trigger orphaned transition states or desynchronized visual values.

Frequently Asked Questions

Explore Related Motion Guides & Tooling

Build your next living interface today.

Design fluid physics and visual logic in ExodeUI and export directly to React, Swift, and Flutter.

Try for free