Sourceful Energy

Switch

A control that allows the user to toggle between on and off states.

Installation

import { Switch } from "@sourceful-energy/ui"

Usage

Examples

Default Checked

Disabled

With Description

Optimize charging based on grid conditions.

Props

PropTypeDefaultDescription
checkedbooleanfalseThe controlled checked state.
defaultCheckedbooleanfalseThe default checked state when uncontrolled.
onCheckedChange(checked: boolean) => void-Callback when the checked state changes.
disabledbooleanfalseWhether the switch is disabled.
idstring-The ID for associating with a label.

Accessibility

  • Uses native switch role via Radix UI
  • Keyboard accessible (Space to toggle)
  • Always pair with a Label for screen readers
  • Visible focus indicator