Switch

A toggle control for binary on/off states, commonly used for settings that take immediate effect.

Capture stream locally while broadcasting

Installation

CLI

Install the component using the StarUI CLI:

star add switch

Examples

States

All visual states — unchecked, checked, disabled, error text, required, small size, and custom styling

Stream key is invalid

Required before going live

Green tint on label and track border

Conditional Display

Master switch cascading dependent encoding layers with data_effect and data_show

Stream Output

Layers applied to the broadcast encoder

Push to ingest server

Form Validation

Required switches that gate form submission with all_() signal logic

Broadcast Mode

Required features before going live

Sub-second glass-to-glass delay

Signal Arithmetic

Weighted bitrate calculation and progress bar driven by per-switch multipliers

Encoder Settings

Estimated bitrate from active options

+6000 kbps

-2000 kbps overhead

+500 kbps

+1500 kbps

Bitrate: (((($sw_enc_hd * 6000) + ($sw_enc_hw * -2000)) + ($sw_enc_bf * 500)) + ($sw_enc_2p * 1500)) kbps

Collect and Reset

Active platform summary via collect() with batch reset

Stream Destinations

Multistream to selected platforms

Active:

Dependent Switches

Multi-level dependency chain with studio mode, per-layer enable, and preview switches

Scene Layers

Sources composited into the broadcast

Preview scene before pushing live

Preview
Preview
Preview

API Reference

Props

Prop Type Default Description
checked bool | None None Initial checked state
signal str | Signal auto-generated Signal name for reactive state management
disabled bool False Disables the switch and blocks pointer events
required bool False Marks as required. SwitchWithLabel appends a red asterisk
size "default" | "sm" "default" Switch track and thumb size
label str - Label text (SwitchWithLabel only)
helper_text str | None None Muted text below the label (SwitchWithLabel only)
error_text str | None None Destructive text below the control. Sets aria-invalid (SwitchWithLabel only)
cls str '' Additional CSS classes
label_cls str '' Additional CSS classes for the label (SwitchWithLabel only)
switch_cls str '' Additional CSS classes for the switch track. Cannot override checked/unchecked background colors (SwitchWithLabel only)
Component Description
Switch Standalone switch control. Renders a button with role=switch and reactive thumb. Compose with Label for manual layout
SwitchWithLabel Convenience wrapper composing Switch + Label + helper/error text with standard spacing