跳转到主要内容

RtkSwitch

{/* AUTO-GENERATED FILE. DO NOT EDIT MANUALLY. Any manual changes will be overwritten the next time the docs are generated.

Source: https://github.com/cloudflare/realtimekit-ui/blob/main/packages/core/src/components/rtk-switch/rtk-switch.tsx Generator: https://github.com/cloudflare/realtimekit-ui/blob/main/scripts/generate-stencil-docs.js

To update this page, edit the component source in the realtimekit-ui repository and submit a pull request against the staging branch; the changes will automatically sync here upon the next release. */}

A switch component which follows RTK Design System.

Properties

Property Type Required Default Description
checked boolean ✅ - Whether the switch is enabled/checked
disabled boolean ✅ - Whether switch is readonly
iconPack IconPack ❌ defaultIconPack Icon pack
readonly boolean ✅ - Whether switch is readonly
t RtkI18n ❌ useLanguage() Language

Usage Examples

Basic Usage

import { RtkSwitch } from '@cloudflare/realtimekit-react-ui';

function MyComponent() {
  return <RtkSwitch />;
}

With Properties

import { RtkSwitch } from '@cloudflare/realtimekit-react-ui';

function MyComponent() {
  return (
    <RtkSwitch
      checked={true}
      disabled={true}
      readonly={true}
    />
  );
}