Components

Switch

v1.0.0

Binary toggle switch for on/off settings.

Import

import { Switch } from '@meteorack/sdk-react';

How To Use It

  • Use it for on/off preferences where the control itself makes the enabled state immediately obvious.
  • Prefer switches for live feature toggles and checkboxes for denser forms with multiple saved changes.

Works Well With

Props

checked?: boolean

Current on/off state.

onChange?: (checked: boolean) => void

Called when the toggle changes.

label?: string

Optional label rendered to the right of the switch.

disabled?: boolean

Disables the switch and lowers its emphasis.

className?: string

Optional class name for the switch wrapper.

Example

Switch.tsx
import { useState } from 'react';
import { Switch } from '@meteorack/sdk-react';

export function FeatureToggle() {
  const [enabled, setEnabled] = useState(true);

  return (
    <Switch
      label="Enable realtime sync"
      checked={enabled}
      onChange={setEnabled}
    />
  );
}