XenForo Xenforo 2 checkbox style in account preferences page

blu3men

Registered
Want toggle buttons on the settings page?
acc_pref.png

Two files should be edited:
1 - account_preferences
2 - extra.less


Let's start :)

Open the "account_preferences" template // Admin > Appearance > Styles *(use filter)*
Look for this:

label="{{ phrase('alert') }}"
Write this (directly, with space):
class="toggle-switch"
Look for this:
label="{{ phrase('push') }}"
Write this (directly, with space):
class="toggle-switch"

SAVE & EXIT

Open the "extra.less" template // Admin > Appearance > Styles *(use filter)*
Insert this code:

CSS:
/*account preferences options style*/
.toggle-switch {
    position: relative;
    width: 50px;
    height: 24px;
    -webkit-appearance: none;
    appearance: none;
    background-color: #ca3b3b;
    outline: none;
    cursor: pointer;
    border-radius: 12px;
    transition: background-color 0.3s;
    display: inline-block;
    vertical-align: middle;
}

.toggle-switch:checked {
    background-color: #66bb6a;
}

.toggle-switch:before {
    content: "OFF";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background-color: #000000;
    border-radius: 50%;
    transition: transform 0.3s, content 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    color: #f30909;
}

.toggle-switch:checked:before {
    content: "ON";
    transform: translateX(26px);
    color: #37fc1d;
}

.notificationChoices-choice--alert .iconic input {
    position: relative;
    width: 50px;
    height: 24px;
    overflow: unset;
    vertical-align: middle;
}

.notificationChoices-choice--alert .iconic input+i {
    display: none;
}

SAVE & EXIT
 
Back
Top Bottom