An open API service indexing awesome lists of open source software.

https://github.com/ahmadasjad/yii2-widgets

An extension for yii2 to decorate input with increase and decrease button
https://github.com/ahmadasjad/yii2-widgets

plus-minus-input yii2 yii2-widget

Last synced: about 2 months ago
JSON representation

An extension for yii2 to decorate input with increase and decrease button

Awesome Lists containing this project

README

        

# yii2-widgets

![Plus-Minus-Input](img/preview-plus-minus-input.png)
###### Installation

```
composer require ahmadasjad/yii2-widgets
```

##### Usage Example

```php
'name_test',
'plugin_options' => ['parser'=>'parseFloat', 'step'=>0.5]
]);
?>
```

**Options to customize the plugin in `plugin_options` param:**

```php
[
'val_min' => 0,
'val_max' => 1000,
'step' => 1,
'parser' => 'parseInt',
'container' => ['class' => 'input-group', 'id' => 'your-custom-id-container'],
'plus' => ['id' => 'your-custom-id-plus', 'class' => 'btn btn-success', 'label' => '+',],
'minus' => ['id' => 'your-custom-id-minus', 'class' => 'btn btn-danger', 'label' => '-',],
]
```

`val_min` Minimum value allowed for input

`val_max` Maximum value allowed for input

`step` How much value to be increased/decreased on press of plus/minus button

`parser` Javascript function to parse the input data. For example `parseInt`, `parseFloat`, etc.

`plus` configuration for plus button
`minus` configuration for plus button