Koori UI
Components

GlassSwitch

A glassmorphism-styled toggle switch powered by Radix UI with optional label support.

Preview

Usage

import { GlassSwitch } from "koori-ui";
 
<GlassSwitch id="notifications" label="Enable notifications" />

Without Label

<GlassSwitch id="toggle" />

Controlled

import { useState } from "react";
import { GlassSwitch } from "koori-ui";
 
function Example() {
  const [enabled, setEnabled] = useState(false);
  return (
    <GlassSwitch
      id="dark-mode"
      checked={enabled}
      onCheckedChange={setEnabled}
      label="Dark mode"
    />
  );
}

Disabled

<GlassSwitch id="disabled" disabled label="Unavailable option" />

Props

PropTypeDefaultDescription
labelstringOptional label rendered beside the switch
idstringHTML id, links the label for accessibility
checkedbooleanControlled checked state
defaultCheckedbooleanInitial state (uncontrolled)
onCheckedChange(checked: boolean) => voidCallback when state changes
disabledbooleanfalseDisables the switch

All Radix Switch.Root props are also accepted.

On this page