代码示例:(标识:bs_form_toggle_switch)
<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.1.2/css/bootstrap.min.css" rel="stylesheet">
  <script src="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.1.2/js/bootstrap.bundle.js"></script>
</head>
<body>

<div class="p-4">
  <h2>拨动开关</h2>
  <p>请尝试在切换和不切换开关的情况下提交表单。</p>
  <form action=/index/demo/form_current.html>
    <div class="form-check form-switch">
      <input class="form-check-input" type="checkbox" id="mySwitch" name="darkmode" value="yes" checked>
      <label class="form-check-label" for="mySwitch">深色模式</label>
    </div>
    <button type="submit" class="btn btn-primary mt-3">提交</button>
  </form>
</div>

</body>
</html>
运行结果: