MiHCM
primitives/@mihcm/ui·v0.21.0·stable

Switch

Controlled on/off toggle. role="switch" with aria-checked driven by checked.

In context

Notification preferences, feature flags, third-party integrations, and a security posture checklist.

Notifications

Per-channel delivery settings.

Daily 08:00 in your timezone
Mobile + desktop
Direct mentions only
Monday at 09:00

Integrations

Enable / disable per workspace.

Push approvals to a channel
Sync tickets to time-off requests
Mirror release notes to repo issues
Create cycles from sprint plans

Basic toggle

import { useState } from 'react';
import { Switch } from '@mihcm/ui/Switch';
import { Label } from '@mihcm/ui/Label';
 
const [enabled, setEnabled] = useState(false);
 
<div className="flex items-center gap-2">
  <Switch id="notif" checked={enabled} onCheckedChange={setEnabled} />
  <Label htmlFor="notif">Push notifications</Label>
</div>

Settings list

import { useState } from 'react';
import { Switch } from '@mihcm/ui/Switch';
import { Label } from '@mihcm/ui/Label';
import { Separator } from '@mihcm/ui/Separator';
 
const [email, setEmail] = useState(true);
const [sms, setSms] = useState(false);
const [marketing, setMarketing] = useState(false);
 
<div className="space-y-4">
  <div className="flex items-center justify-between">
    <Label htmlFor="email">Email notifications</Label>
    <Switch id="email" checked={email} onCheckedChange={setEmail} />
  </div>
  <Separator />
  <div className="flex items-center justify-between">
    <Label htmlFor="sms">SMS alerts</Label>
    <Switch id="sms" checked={sms} onCheckedChange={setSms} />
  </div>
  <Separator />
  <div className="flex items-center justify-between">
    <Label htmlFor="marketing">Marketing emails</Label>
    <Switch id="marketing" checked={marketing} onCheckedChange={setMarketing} />
  </div>
</div>

Disabled

<Switch id="locked" checked={true} onCheckedChange={() => {}} disabled />