Страница 1 из 1
Switch из Bootstrap 4
Добавлено: 2019.09.20, 17:02
smertnik77
Собственно как правильно оформить чекбокс в форме чтобы получился свитч?
Re: Switch из Bootstrap 4
Добавлено: 2019.09.20, 17:23
yiiliveext
Прописать нужный template в поле и использовать стандартный checkbox или использовать готовый виджет вроде
https://demos.krajee.com/widget-details/switchinput
Re: Switch из Bootstrap 4
Добавлено: 2019.09.20, 20:19
smertnik77
Хотелось бы увидеть код для бустраповского свитча
Re: Switch из Bootstrap 4
Добавлено: 2019.09.20, 20:30
yiiliveext
Которго свитча? Приведите код чистой реализации.
Re: Switch из Bootstrap 4
Добавлено: 2019.09.20, 20:33
smertnik77
<div class="custom-control custom-switch">
<input type="checkbox" class="custom-control-input" id="customSwitch1">
<label class="custom-control-label" for="customSwitch1">Toggle this switch element</label>
</div>
Re: Switch из Bootstrap 4
Добавлено: 2019.09.20, 21:06
yiiliveext
Код: Выделить всё
<?= $form->field($model, 'rememberMe')->checkbox([
'template' => "<div class=\"custom-control custom-switch\">{input} {label}</div>\n<div>{error}</div>",
'class' => 'custom-control-input'])->label('Remember Me', ['class' => 'custom-control-label']) ?>
Re: Switch из Bootstrap 4
Добавлено: 2019.09.21, 08:47
smertnik77
Спасибо.