UNPKG

rsuite-theme

Version:
140 lines (120 loc) 2.6 kB
.btn-toggle { position: relative; display: inline-block; box-sizing: border-box; height: 22px; min-width: 44px; line-height: 20px; vertical-align: middle; border-radius: 20px; border: 1px solid transparent; background-color: rgba(0, 0, 0, .25); cursor: pointer; transition: all .36s; user-select: none; .toggle-inner { color: #fff; font-size: 12px; margin-left: 24px; margin-right: 6px; display: block; transition: margin .3s linear; } &.disabled { cursor: not-allowed; background: #f4f4f4; &.toggle-checked { background: @toggle-disabled-background-color; } } &:active:after { width: 24px; } &-checked:active:after { margin-left: -25px; } &:after { position: absolute; width: 18px; height: 18px; left: 1px; top: 1px; border-radius: 18px; background-color: #fff; content: " "; cursor: pointer; transition: all .36s cubic-bezier(.78, .14, .15, .86); } &-checked { background-color: @toggle-background-color; .toggle-inner { margin-left: 6px; margin-right: 24px; } } &-checked::after { left: 100%; margin-left: -19px; } } //large .btn-toggle.btn-toggle-lg { height: 30px; min-width: 64px; border-radius: 23px; line-height: 40px; &:after { width: 26px; height: 26px; top: 1px; left: 1px; border-radius: 20px; } &:active:after { width: 32px } &.btn-toggle-checked:active:after { margin-left: 27.5px; } &.btn-toggle-checked:after { margin-left: 34px } .toggle-inner { height: 30px; line-height: 28px; margin-right: 0; margin-left: 30px; } &.btn-toggle-checked .toggle-inner { margin-right: 0; margin-left: 6px; } } //small .btn-toggle.btn-toggle-sm { height: 14px; min-width: 28px; line-height: 12px; .toggle-inner { margin-left: 13px; margin-right: 1px; } &:after { width: 12px; height: 12px; top: 0; left: .5px } &:active:after { width: 16px } &.btn-toggle-checked .toggle-inner { margin-left: 1px; } &.btn-toggle-checked:active:after { margin-left: 12.5px; } &.btn-toggle-checked:after { margin-left: 13.5px } }