Bootstrap Toggle Buttons - Component Snippets
Bootstrap toggle buttons are a type of button that stays hidden until you hover over it. Used for save/delete, active/deactivate, upvote/downvote, and many other purposes.
Primary Toggle Button
<!-- start switch btn -->
<label class="switch-btn">
<input type="checkbox" />
<div class="switch-body">
<span class="slide">
<span class="icon active-icon">
<i class="lni lni-checkmark"></i>
</span>
<span class="icon inactive-icon">
<i class="lni lni-close"></i>
</span>
</span>
</div>
</label>
<!-- end switch btn -->
.switch-buttons {
display: flex;
flex-wrap: wrap;
align-items: center;
}
.switch-buttons > * {
margin-right: 30px;
margin-bottom: 30px;
}
.switch-btn {
width: 54px;
height: 32px;
position: relative;
cursor: pointer;
}
.switch-btn input {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
opacity: 0;
z-index: 1;
cursor: pointer;
}
.switch-btn input:checked ~ .switch-body .slide .inactive-icon {
display: flex;
}
.switch-btn input:checked ~ .switch-body .slide {
right: auto;
left: 2px;
}
.switch-btn input:checked ~ .switch-body .slide .active-icon {
display: none;
}
.switch-btn .slide {
width: 28px;
height: 28px;
border-radius: 50%;
overflow: hidden;
color: var(--white);
display: inline-flex;
align-items: center;
justify-content: center;
position: absolute;
right: 2px;
top: 2px;
transition: all 0.3s;
}
.switch-btn .slide .icon {
width: 100%;
height: 100%;
display: inline-flex;
align-items: center;
justify-content: center;
font-weight: 700;
padding: 4px;
}
.switch-btn .slide .inactive-icon {
display: none;
background: #e0e0e0;
color: var(--dark-3);
}
.switch-btn .slide .active-icon {
background: var(--primary);
}
.switch-btn .switch-body {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: #fafafa;
box-shadow: 0px 0px 1px rgba(40, 41, 61, 0.08), 0px 0.5px 2px rgba(96, 97, 112, 0.16);
border-radius: 24px;
}
Success Toggle Button
<!-- start switch btn -->
<label class="switch-btn switch-btn-success">
<input type="checkbox" />
<div class="switch-body">
<span class="slide">
<span class="icon active-icon">
<i class="lni lni-checkmark"></i>
</span>
<span class="icon inactive-icon">
<i class="lni lni-close"></i>
</span>
</span>
</div>
</label>
<!-- end switch btn -->
.switch-buttons {
display: flex;
flex-wrap: wrap;
align-items: center;
}
.switch-buttons > * {
margin-right: 30px;
margin-bottom: 30px;
}
.switch-btn {
width: 54px;
height: 32px;
position: relative;
cursor: pointer;
}
.switch-btn input {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
opacity: 0;
z-index: 1;
cursor: pointer;
}
.switch-btn input:checked ~ .switch-body .slide .inactive-icon {
display: flex;
}
.switch-btn input:checked ~ .switch-body .slide {
right: auto;
left: 2px;
}
.switch-btn input:checked ~ .switch-body .slide .active-icon {
display: none;
}
.switch-btn .slide {
width: 28px;
height: 28px;
border-radius: 50%;
overflow: hidden;
color: var(--white);
display: inline-flex;
align-items: center;
justify-content: center;
position: absolute;
right: 2px;
top: 2px;
transition: all 0.3s;
}
.switch-btn .slide .icon {
width: 100%;
height: 100%;
display: inline-flex;
align-items: center;
justify-content: center;
font-weight: 700;
padding: 4px;
}
.switch-btn .slide .inactive-icon {
display: none;
background: #e0e0e0;
color: var(--dark-3);
}
.switch-btn .slide .active-icon {
background: var(--primary);
}
.switch-btn .switch-body {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: #fafafa;
box-shadow: 0px 0px 1px rgba(40, 41, 61, 0.08), 0px 0.5px 2px rgba(96, 97, 112, 0.16);
border-radius: 24px;
}
.switch-btn-success .slide .active-icon {
background: var(--success);
}
.switch-btn-text-success .switch-body .slide-text .active {
color: var(--success);
}
.switch-btn-text-success .slide .active-icon {
background: var(--success);
}
Primary Toggle Button With Text
<!-- start switch btn -->
<label class="switch-btn-text">
<input type="checkbox" />
<div class="switch-body">
<span class="slide-text">
<span class="text active">Active</span>
</span>
<span class="slide">
<span class="icon active-icon">
<i class="lni lni-checkmark"></i>
</span>
<span class="icon inactive-icon">
<i class="lni lni-close"></i>
</span>
</span>
<span class="slide-text">
<span class="text inactive">Inactive</span>
</span>
</div>
</label>
<!-- end switch btn -->
.switch-buttons {
display: flex;
flex-wrap: wrap;
align-items: center;
}
.switch-buttons > * {
margin-right: 30px;
margin-bottom: 30px;
}
.switch-btn {
width: 54px;
height: 32px;
position: relative;
cursor: pointer;
}
.switch-btn input {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
opacity: 0;
z-index: 1;
cursor: pointer;
}
.switch-btn input:checked ~ .switch-body .slide .inactive-icon {
display: flex;
}
.switch-btn input:checked ~ .switch-body .slide {
right: auto;
left: 2px;
}
.switch-btn input:checked ~ .switch-body .slide .active-icon {
display: none;
}
.switch-btn .slide {
width: 28px;
height: 28px;
border-radius: 50%;
overflow: hidden;
color: var(--white);
display: inline-flex;
align-items: center;
justify-content: center;
position: absolute;
right: 2px;
top: 2px;
transition: all 0.3s;
}
.switch-btn .slide .icon {
width: 100%;
height: 100%;
display: inline-flex;
align-items: center;
justify-content: center;
font-weight: 700;
padding: 4px;
}
.switch-btn .slide .inactive-icon {
display: none;
background: #e0e0e0;
color: var(--dark-3);
}
.switch-btn .slide .active-icon {
background: var(--primary);
}
.switch-btn .switch-body {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: #fafafa;
box-shadow: 0px 0px 1px rgba(40, 41, 61, 0.08), 0px 0.5px 2px rgba(96, 97, 112, 0.16);
border-radius: 24px;
}
.switch-btn-text {
width: auto;
height: 32px;
position: relative;
cursor: pointer;
}
.switch-btn-text input:checked ~ .switch-body .slide-text .active {
display: none;
}
.switch-btn-text input:checked ~ .switch-body .slide-text .inactive {
display: flex;
}
.switch-btn-text input {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
opacity: 0;
z-index: 1;
cursor: pointer;
}
.switch-btn-text input:checked ~ .switch-body .slide .inactive-icon {
display: flex;
}
.switch-btn-text input:checked ~ .switch-body .slide {
right: auto;
left: 2px;
}
.switch-btn-text input:checked ~ .switch-body .slide .active-icon {
display: none;
}
.switch-btn-text .switch-body .slide-text .inactive {
display: none;
padding-left: 36px;
padding-right: 6px;
color: var(--dark-3);
}
.switch-btn-text .slide-text .text {
font-size: 12px;
font-weight: 600;
display: flex;
align-items: center;
}
.switch-btn-text .switch-body .slide-text .active {
padding-right: 36px;
padding-left: 6px;
color: var(--primary);
}
.switch-btn-text .slide {
width: 28px;
height: 28px;
border-radius: 50%;
overflow: hidden;
color: var(--white);
display: inline-flex;
align-items: center;
justify-content: center;
position: absolute;
right: 2px;
top: 2px;
transition: all 0.3s;
}
.switch-btn-text .slide .icon {
width: 100%;
height: 100%;
display: inline-flex;
align-items: center;
justify-content: center;
font-weight: 700;
padding: 4px;
}
.switch-btn-text .slide .inactive-icon {
display: none;
background: #e0e0e0;
color: var(--dark-3);
}
.switch-btn-text .slide .active-icon {
background: var(--primary);
}
.switch-btn-text .switch-body {
display: flex;
justify-content: space-between;
align-items: center;
position: relative;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: #fafafa;
box-shadow: 0px 0px 1px rgba(40, 41, 61, 0.08), 0px 0.5px 2px rgba(96, 97, 112, 0.16);
border-radius: 24px;
}
Error Toggle Button
<!-- start switch btn -->
<label class="switch-btn switch-btn-error">
<input type="checkbox" />
<div class="switch-body">
<span class="slide">
<span class="icon active-icon">
<i class="lni lni-checkmark"></i>
</span>
<span class="icon inactive-icon">
<i class="lni lni-close"></i>
</span>
</span>
</div>
</label>
<!-- end switch btn -->
.switch-buttons {
display: flex;
flex-wrap: wrap;
align-items: center;
}
.switch-buttons > * {
margin-right: 30px;
margin-bottom: 30px;
}
.switch-btn {
width: 54px;
height: 32px;
position: relative;
cursor: pointer;
}
.switch-btn input {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
opacity: 0;
z-index: 1;
cursor: pointer;
}
.switch-btn input:checked ~ .switch-body .slide .inactive-icon {
display: flex;
}
.switch-btn input:checked ~ .switch-body .slide {
right: auto;
left: 2px;
}
.switch-btn input:checked ~ .switch-body .slide .active-icon {
display: none;
}
.switch-btn .slide {
width: 28px;
height: 28px;
border-radius: 50%;
overflow: hidden;
color: var(--white);
display: inline-flex;
align-items: center;
justify-content: center;
position: absolute;
right: 2px;
top: 2px;
transition: all 0.3s;
}
.switch-btn .slide .icon {
width: 100%;
height: 100%;
display: inline-flex;
align-items: center;
justify-content: center;
font-weight: 700;
padding: 4px;
}
.switch-btn .slide .inactive-icon {
display: none;
background: #e0e0e0;
color: var(--dark-3);
}
.switch-btn .slide .active-icon {
background: var(--error);
}
.switch-btn .switch-body {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: #fafafa;
box-shadow: 0px 0px 1px rgba(40, 41, 61, 0.08), 0px 0.5px 2px rgba(96, 97, 112, 0.16);
border-radius: 24px;
}
.switch-btn-text {
width: auto;
height: 32px;
position: relative;
cursor: pointer;
}
.switch-btn-text input:checked ~ .switch-body .slide-text .active {
display: none;
}
.switch-btn-text input:checked ~ .switch-body .slide-text .inactive {
display: flex;
}
.switch-btn-text input {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
opacity: 0;
z-index: 1;
cursor: pointer;
}
.switch-btn-text input:checked ~ .switch-body .slide .inactive-icon {
display: flex;
}
.switch-btn-text input:checked ~ .switch-body .slide {
right: auto;
left: 2px;
}
.switch-btn-text input:checked ~ .switch-body .slide .active-icon {
display: none;
}
.switch-btn-text .switch-body .slide-text .inactive {
display: none;
padding-left: 36px;
padding-right: 6px;
color: var(--dark-3);
}
.switch-btn-text .slide-text .text {
font-size: 12px;
font-weight: 600;
display: flex;
align-items: center;
}
.switch-btn-text .switch-body .slide-text .active {
padding-right: 36px;
padding-left: 6px;
color: var(--error);
}
.switch-btn-text .slide {
width: 28px;
height: 28px;
border-radius: 50%;
overflow: hidden;
color: var(--white);
display: inline-flex;
align-items: center;
justify-content: center;
position: absolute;
right: 2px;
top: 2px;
transition: all 0.3s;
}
.switch-btn-text .slide .icon {
width: 100%;
height: 100%;
display: inline-flex;
align-items: center;
justify-content: center;
font-weight: 700;
padding: 4px;
}
.switch-btn-text .slide .inactive-icon {
display: none;
background: #e0e0e0;
color: var(--dark-3);
}
.switch-btn-text .slide .active-icon {
background: var(--error);
}
.switch-btn-text .switch-body {
display: flex;
justify-content: space-between;
align-items: center;
position: relative;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: #fafafa;
box-shadow: 0px 0px 1px rgba(40, 41, 61, 0.08), 0px 0.5px 2px rgba(96, 97, 112, 0.16);
border-radius: 24px;
}
.switch-btn-error .slide .active-icon {
background: var(--error);
}
Secondary Toggle Button
<!-- start switch btn -->
<label class="switch-btn switch-btn-secondary">
<input type="checkbox" />
<div class="switch-body">
<span class="slide">
<span class="icon active-icon">
<i class="lni lni-checkmark"></i>
</span>
<span class="icon inactive-icon">
<i class="lni lni-close"></i>
</span>
</span>
</div>
</label>
<!-- end switch btn -->
.switch-buttons {
display: flex;
flex-wrap: wrap;
align-items: center;
}
.switch-buttons > * {
margin-right: 30px;
margin-bottom: 30px;
}
.switch-btn {
width: 54px;
height: 32px;
position: relative;
cursor: pointer;
}
.switch-btn input {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
opacity: 0;
z-index: 1;
cursor: pointer;
}
.switch-btn input:checked ~ .switch-body .slide .inactive-icon {
display: flex;
}
.switch-btn input:checked ~ .switch-body .slide {
right: auto;
left: 2px;
}
.switch-btn input:checked ~ .switch-body .slide .active-icon {
display: none;
}
.switch-btn .slide {
width: 28px;
height: 28px;
border-radius: 50%;
overflow: hidden;
color: var(--white);
display: inline-flex;
align-items: center;
justify-content: center;
position: absolute;
right: 2px;
top: 2px;
transition: all 0.3s;
}
.switch-btn .slide .icon {
width: 100%;
height: 100%;
display: inline-flex;
align-items: center;
justify-content: center;
font-weight: 700;
padding: 4px;
}
.switch-btn .slide .inactive-icon {
display: none;
background: #e0e0e0;
color: var(--dark-3);
}
.switch-btn .slide .active-icon {
background: var(--primary);
}
.switch-btn .switch-body {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: #fafafa;
box-shadow: 0px 0px 1px rgba(40, 41, 61, 0.08), 0px 0.5px 2px rgba(96, 97, 112, 0.16);
border-radius: 24px;
}
.switch-btn-secondary .slide .active-icon {
background: var(--secondary);
}
.switch-btn-text-secondary .switch-body .slide-text .active {
color: var(--secondary);
}
.switch-btn-text-secondary .slide .active-icon {
background: var(--secondary);
}
Error Toggle Button With Text
<!-- start switch btn -->
<label class="switch-btn-text switch-btn-text-error">
<input type="checkbox" />
<div class="switch-body">
<span class="slide-text">
<span class="text active">Active</span>
</span>
<span class="slide">
<span class="icon active-icon">
<i class="lni lni-checkmark"></i>
</span>
<span class="icon inactive-icon">
<i class="lni lni-close"></i>
</span>
</span>
<span class="slide-text">
<span class="text inactive">Inactive</span>
</span>
</div>
</label>
<!-- end switch btn -->
.switch-buttons {
display: flex;
flex-wrap: wrap;
align-items: center;
}
.switch-buttons > * {
margin-right: 30px;
margin-bottom: 30px;
}
.switch-btn {
width: 54px;
height: 32px;
position: relative;
cursor: pointer;
}
.switch-btn input {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
opacity: 0;
z-index: 1;
cursor: pointer;
}
.switch-btn input:checked ~ .switch-body .slide .inactive-icon {
display: flex;
}
.switch-btn input:checked ~ .switch-body .slide {
right: auto;
left: 2px;
}
.switch-btn input:checked ~ .switch-body .slide .active-icon {
display: none;
}
.switch-btn .slide {
width: 28px;
height: 28px;
border-radius: 50%;
overflow: hidden;
color: var(--white);
display: inline-flex;
align-items: center;
justify-content: center;
position: absolute;
right: 2px;
top: 2px;
transition: all 0.3s;
}
.switch-btn .slide .icon {
width: 100%;
height: 100%;
display: inline-flex;
align-items: center;
justify-content: center;
font-weight: 700;
padding: 4px;
}
.switch-btn .slide .inactive-icon {
display: none;
background: #e0e0e0;
color: var(--dark-3);
}
.switch-btn .switch-body {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: #fafafa;
box-shadow: 0px 0px 1px rgba(40, 41, 61, 0.08), 0px 0.5px 2px rgba(96, 97, 112, 0.16);
border-radius: 24px;
}
.switch-btn-text {
width: auto;
height: 32px;
position: relative;
cursor: pointer;
}
.switch-btn-text input:checked ~ .switch-body .slide-text .active {
display: none;
}
.switch-btn-text input:checked ~ .switch-body .slide-text .inactive {
display: flex;
}
.switch-btn-text input {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
opacity: 0;
z-index: 1;
cursor: pointer;
}
.switch-btn-text input:checked ~ .switch-body .slide .inactive-icon {
display: flex;
}
.switch-btn-text input:checked ~ .switch-body .slide {
right: auto;
left: 2px;
}
.switch-btn-text input:checked ~ .switch-body .slide .active-icon {
display: none;
}
.switch-btn-text .switch-body .slide-text .inactive {
display: none;
padding-left: 36px;
padding-right: 6px;
color: var(--dark-3);
}
.switch-btn-text .slide-text .text {
font-size: 12px;
font-weight: 600;
display: flex;
align-items: center;
}
.switch-btn-text .switch-body .slide-text .active {
padding-right: 36px;
padding-left: 6px;
color: var(--error);
}
.switch-btn-text .slide {
width: 28px;
height: 28px;
border-radius: 50%;
overflow: hidden;
color: var(--white);
display: inline-flex;
align-items: center;
justify-content: center;
position: absolute;
right: 2px;
top: 2px;
transition: all 0.3s;
}
.switch-btn-text .slide .icon {
width: 100%;
height: 100%;
display: inline-flex;
align-items: center;
justify-content: center;
font-weight: 700;
padding: 4px;
}
.switch-btn-text .slide .inactive-icon {
display: none;
background: #e0e0e0;
color: var(--dark-3);
}
.switch-btn-text .switch-body {
display: flex;
justify-content: space-between;
align-items: center;
position: relative;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: #fafafa;
box-shadow: 0px 0px 1px rgba(40, 41, 61, 0.08), 0px 0.5px 2px rgba(96, 97, 112, 0.16);
border-radius: 24px;
}
.switch-btn-error .slide .active-icon {
background: var(--error);
}
.switch-btn-text-error .switch-body .slide-text .active {
color: var(--error);
}
.switch-btn-text-error .slide .active-icon {
background: var(--error);
}
Success Toggle Button With Text
<!-- start switch btn -->
<label class="switch-btn-text switch-btn-text-success">
<input type="checkbox" />
<div class="switch-body">
<span class="slide-text">
<span class="text active">Active</span>
</span>
<span class="slide">
<span class="icon active-icon">
<i class="lni lni-checkmark"></i>
</span>
<span class="icon inactive-icon">
<i class="lni lni-close"></i>
</span>
</span>
<span class="slide-text">
<span class="text inactive">Inactive</span>
</span>
</div>
</label>
<!-- end switch btn -->
.switch-buttons {
display: flex;
flex-wrap: wrap;
align-items: center;
}
.switch-buttons > * {
margin-right: 30px;
margin-bottom: 30px;
}
.switch-btn {
width: 54px;
height: 32px;
position: relative;
cursor: pointer;
}
.switch-btn input {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
opacity: 0;
z-index: 1;
cursor: pointer;
}
.switch-btn input:checked ~ .switch-body .slide .inactive-icon {
display: flex;
}
.switch-btn input:checked ~ .switch-body .slide {
right: auto;
left: 2px;
}
.switch-btn input:checked ~ .switch-body .slide .active-icon {
display: none;
}
.switch-btn .slide {
width: 28px;
height: 28px;
border-radius: 50%;
overflow: hidden;
color: var(--white);
display: inline-flex;
align-items: center;
justify-content: center;
position: absolute;
right: 2px;
top: 2px;
transition: all 0.3s;
}
.switch-btn .slide .icon {
width: 100%;
height: 100%;
display: inline-flex;
align-items: center;
justify-content: center;
font-weight: 700;
padding: 4px;
}
.switch-btn .slide .inactive-icon {
display: none;
background: #e0e0e0;
color: var(--dark-3);
}
.switch-btn .switch-body {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: #fafafa;
box-shadow: 0px 0px 1px rgba(40, 41, 61, 0.08), 0px 0.5px 2px rgba(96, 97, 112, 0.16);
border-radius: 24px;
}
.switch-btn-text {
width: auto;
height: 32px;
position: relative;
cursor: pointer;
}
.switch-btn-text input:checked ~ .switch-body .slide-text .active {
display: none;
}
.switch-btn-text input:checked ~ .switch-body .slide-text .inactive {
display: flex;
}
.switch-btn-text input {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
opacity: 0;
z-index: 1;
cursor: pointer;
}
.switch-btn-text input:checked ~ .switch-body .slide .inactive-icon {
display: flex;
}
.switch-btn-text input:checked ~ .switch-body .slide {
right: auto;
left: 2px;
}
.switch-btn-text input:checked ~ .switch-body .slide .active-icon {
display: none;
}
.switch-btn-text .switch-body .slide-text .inactive {
display: none;
padding-left: 36px;
padding-right: 6px;
color: var(--dark-3);
}
.switch-btn-text .slide-text .text {
font-size: 12px;
font-weight: 600;
display: flex;
align-items: center;
}
.switch-btn-text .switch-body .slide-text .active {
padding-right: 36px;
padding-left: 6px;
color: var(--success);
}
.switch-btn-text .slide {
width: 28px;
height: 28px;
border-radius: 50%;
overflow: hidden;
color: var(--white);
display: inline-flex;
align-items: center;
justify-content: center;
position: absolute;
right: 2px;
top: 2px;
transition: all 0.3s;
}
.switch-btn-text .slide .icon {
width: 100%;
height: 100%;
display: inline-flex;
align-items: center;
justify-content: center;
font-weight: 700;
padding: 4px;
}
.switch-btn-text .slide .inactive-icon {
display: none;
background: #e0e0e0;
color: var(--dark-3);
}
.switch-btn-text .switch-body {
display: flex;
justify-content: space-between;
align-items: center;
position: relative;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: #fafafa;
box-shadow: 0px 0px 1px rgba(40, 41, 61, 0.08), 0px 0.5px 2px rgba(96, 97, 112, 0.16);
border-radius: 24px;
}
.switch-btn-success .slide .active-icon {
background: var(--success);
}
.switch-btn-success .slide .active-icon {
background: var(--success);
}
.switch-btn-text-success .switch-body .slide-text .active {
color: var(--success);
}
.switch-btn-text-success .slide .active-icon {
background: var(--success);
}
Secondary Toggle Button With Text
<!-- start switch btn -->
<label class="switch-btn-text switch-btn-text-secondary">
<input type="checkbox" />
<div class="switch-body">
<span class="slide-text">
<span class="text active">Active</span>
</span>
<span class="slide">
<span class="icon active-icon">
<i class="lni lni-checkmark"></i>
</span>
<span class="icon inactive-icon">
<i class="lni lni-close"></i>
</span>
</span>
<span class="slide-text">
<span class="text inactive">Inactive</span>
</span>
</div>
</label>
<!-- end switch btn -->
.switch-buttons {
display: flex;
flex-wrap: wrap;
align-items: center;
}
.switch-buttons > * {
margin-right: 30px;
margin-bottom: 30px;
}
.switch-btn {
width: 54px;
height: 32px;
position: relative;
cursor: pointer;
}
.switch-btn input {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
opacity: 0;
z-index: 1;
cursor: pointer;
}
.switch-btn input:checked ~ .switch-body .slide .inactive-icon {
display: flex;
}
.switch-btn input:checked ~ .switch-body .slide {
right: auto;
left: 2px;
}
.switch-btn input:checked ~ .switch-body .slide .active-icon {
display: none;
}
.switch-btn .slide {
width: 28px;
height: 28px;
border-radius: 50%;
overflow: hidden;
color: var(--white);
display: inline-flex;
align-items: center;
justify-content: center;
position: absolute;
right: 2px;
top: 2px;
transition: all 0.3s;
}
.switch-btn .slide .icon {
width: 100%;
height: 100%;
display: inline-flex;
align-items: center;
justify-content: center;
font-weight: 700;
padding: 4px;
}
.switch-btn .slide .inactive-icon {
display: none;
background: #e0e0e0;
color: var(--dark-3);
}
.switch-btn .switch-body {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: #fafafa;
box-shadow: 0px 0px 1px rgba(40, 41, 61, 0.08), 0px 0.5px 2px rgba(96, 97, 112, 0.16);
border-radius: 24px;
}
.switch-btn-text {
width: auto;
height: 32px;
position: relative;
cursor: pointer;
}
.switch-btn-text input:checked ~ .switch-body .slide-text .active {
display: none;
}
.switch-btn-text input:checked ~ .switch-body .slide-text .inactive {
display: flex;
}
.switch-btn-text input {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
opacity: 0;
z-index: 1;
cursor: pointer;
}
.switch-btn-text input:checked ~ .switch-body .slide .inactive-icon {
display: flex;
}
.switch-btn-text input:checked ~ .switch-body .slide {
right: auto;
left: 2px;
}
.switch-btn-text input:checked ~ .switch-body .slide .active-icon {
display: none;
}
.switch-btn-text .switch-body .slide-text .inactive {
display: none;
padding-left: 36px;
padding-right: 6px;
color: var(--dark-3);
}
.switch-btn-text .slide-text .text {
font-size: 12px;
font-weight: 600;
display: flex;
align-items: center;
}
.switch-btn-text .switch-body .slide-text .active {
padding-right: 36px;
padding-left: 6px;
color: var(--secondary);
}
.switch-btn-text .slide {
width: 28px;
height: 28px;
border-radius: 50%;
overflow: hidden;
color: var(--white);
display: inline-flex;
align-items: center;
justify-content: center;
position: absolute;
right: 2px;
top: 2px;
transition: all 0.3s;
}
.switch-btn-text .slide .icon {
width: 100%;
height: 100%;
display: inline-flex;
align-items: center;
justify-content: center;
font-weight: 700;
padding: 4px;
}
.switch-btn-text .slide .inactive-icon {
display: none;
background: #e0e0e0;
color: var(--dark-3);
}
.switch-btn-text .switch-body {
display: flex;
justify-content: space-between;
align-items: center;
position: relative;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: #fafafa;
box-shadow: 0px 0px 1px rgba(40, 41, 61, 0.08), 0px 0.5px 2px rgba(96, 97, 112, 0.16);
border-radius: 24px;
}
.switch-btn-secondary .slide .active-icon {
background: var(--secondary);
}
.switch-btn-text-secondary .switch-body .slide-text .active {
color: var(--secondary);
}
.switch-btn-text-secondary .slide .active-icon {
background: var(--secondary);
}
.switch-btn-success .slide .active-icon {
background: var(--success);
}