HTML
xxxxxxxxxx
1
<div class="container my-4">
2
3
<p class="font-weight-bold">Bootstrap switch/toggle is a simple component used for activating one of two predefined options. Commonly used as an on/off button.</p>
4
5
<p><strong>Detailed documentation and more examples you can find in our <a href="https://mdbootstrap.com/docs/jquery/forms/switch/"
6
target="_blank">Bootstrap Toggle Docs</a> </p>
7
8
<hr>
9
10
<p class="font-weight-bold">Basic examples</p>
11
12
<div class="row">
13
14
<!-- Grid column -->
15
<div class="col-md-6 mb-4 mb-md-0">
16
17
<!-- Title -->
18
<h2 class="mb-3">
19
Default switch
20
</h2>
21
22
<!-- Description -->
23
<p>A switch has the markup of a custom checkbox but uses the <code>.custom-switch</code> class to render a toggle
24
switch.
25
Switches also support the <code>disabled</code> attribute.</p>
26
27
<!-- Section: Live preview -->
28
<section class="section-preview">
29
30
<div class="custom-control custom-switch">
31
<input type="checkbox" class="custom-control-input" id="customSwitches">
32
<label class="custom-control-label" for="customSwitches">Toggle this switch element</label>
33
</div>
34
35
<div class="custom-control custom-switch">
36
<input type="checkbox" class="custom-control-input" id="customSwitches1" checked="">
37
<label class="custom-control-label" for="customSwitches1">Toggle this switch element</label>
38
</div>
39
40
</section>
41
<!-- Section: Live preview -->
42
43
</div>
44
<!-- Grid column -->
45
46
<!-- Grid column -->
47
<div class="col-md-6 mb-4 mb-md-0">
48
49
<!-- Title -->
50
<h2 class="">
51
Material switch
52
<a href="https://mdbootstrap.com/products/jquery-ui-kit/" target="_blank" class="btn btn-danger btn-sm waves-effect waves-light" role="button">MDB
53
Pro component
54
<i class="far fa-gem ml-1"></i>
55
</a>
56
</h2>
57
58
<!-- Description -->
59
<p>Material Design styling for the Bootstrap Switch component</p>
60
61
<!-- Section: Live preview -->
62
<section class="section-preview">
63
64
<!-- Disabled Switch -->
65
<div class="switch">
66
<label>
67
Off
68
<input type="checkbox">
69
<span class="lever"></span> On
70
</label>
71
</div>
72
73
<!-- Switch -->
74
<div class="switch">
75
<label>
76
Off
77
<input type="checkbox" checked="checked">
78
<span class="lever"></span> On
79
</label>
80
</div>
81
82
</section>
83
<!-- Section: Live preview -->
84
85
</div>
86
<!-- Grid column -->
87
88
</div>
89
90
</div>
CSS
1
1
JS
1
1
Console errors: 0