Numstepper является надстройкой над InputWidget, предназначен для адаптивных сайтов, удобен в применении на декстопе и на мобильных устройствах.
Numstepper is an add-on above the InputWidget, designed for adaptive sites, convenient for use on the desktop and on mobile devices.
<?= $form->field($model,'day')->widget(\ekilei\numstepper\Numstepper::className()) ?>
?>
With parameters
<?= $form->field($model,'day')->widget(\ekilei\numstepper\Numstepper::className(),
[
'min' => -28,
'max' => 28,
])
?>
With exception and initialization value
<?= $form->field($model,'day')->widget(\ekilei\numstepper\Numstepper::className(),
[
'min' => -28,
'max' => 28,
'exclude' => [0],
'default' => (int)$model->day ? (int)$model->day : 1,
])
?>
With a hint
<?= $form->field($model,'day')->widget(\ekilei\numstepper\Numstepper::className(),
[
'min' => -28,
'max' => 28,
'exclude' => [0],
'default' => (int)$model->day ? (int)$model->day : 1,
])
->hint(Yii::t('app','Negative numbers make it possible to choose a day from the end of the month.').'
<br>'.Yii::t('app','Example').': "-1" = [31,30,28(29)], а "-3" = [29,28,26(27)] ')
?>
With own icon buttons
<?= $form->field($model,'day')->widget(\ekilei\numstepper\Numstepper::className(),
[
'default' => (int)$model->day ? (int)$model->day : 1,
'minusButton' => 'menu-down',
'plusButton' => 'menu-up',
])
?>
With the change in the arrangement of the buttons
<?= $form->field($model,'day')->widget(\ekilei\numstepper\Numstepper::className(),
[
'default' => (int)$model->day ? (int)$model->day : 1,
'minusButton' => 'menu-down',
'plusButton' => 'menu-up',
'prepend' => [],
'append' => ['{minus}','{plus}'],
])
?>
Install
composer require ekilei/yii2-numstepper-widget "dev-master"



