<!DOCTYPE html>
<html lang="zh-CN"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Kole UI · 开关 Switch（普通 H5）</title>
<link rel="stylesheet" href="../.design_library/kole-ui/colors_and_type.css"><link rel="stylesheet" href="Switch.css">
<style>.demo{padding:24px;background:var(--kole-color-page-bg);font-family:var(--kole-font-family)}.demo h1{margin:0 0 4px;font-size:20px;color:var(--kole-color-text-title)}.sub{margin:0 0 20px;color:var(--kole-color-text-secondary);font-size:12px}.demo-block{padding:16px;margin-bottom:16px;background:var(--kole-color-card-bg);border:1px solid var(--kole-color-border);border-radius:var(--kole-radius-large)}.demo-block h2{margin:0 0 12px;font-size:14px;color:var(--kole-color-text-title)}.row{display:flex;flex-wrap:wrap;align-items:center;gap:12px}.demo-note{margin:12px 0 0;color:var(--kole-color-text-secondary);font-size:12px}</style></head>
<body><div class="demo"><h1>开关 Switch（纯 H5）</h1><p class="sub">即时启停配置项或业务状态，例如启用通知、公开数据和自动同步。</p><div class="demo-block"><h2>默认与常用变体</h2><div class="row kole-switch"><button class="kole-switch-switch is-on" type="button" role="switch" aria-checked="true" aria-label="启用通知" data-toggle></button><span>启用通知</span></div></div><div class="demo-block"><h2>状态与使用场景</h2><div class="row kole-switch"><div class="kole-switch-surface" style="padding:12px">即时启停配置项或业务状态，例如启用通知、公开数据和自动同步。</div><span class="kole-switch-desc">支持键盘焦点、状态反馈和令牌化样式。</span></div><p class="demo-note">零运行时依赖；数据请求、权限和国际化由宿主接入方决定。</p></div></div><script>(function () { document.querySelector('.kole-switch [data-toggle]').addEventListener('click', function () { var on = this.getAttribute('aria-checked') !== 'true'; this.setAttribute('aria-checked', String(on)); this.classList.toggle('is-on', on); }); }());</script></body></html>