https://github.com/yii2-extensions/selectize
Selectize.
https://github.com/yii2-extensions/selectize
selectize widget yii2 yii2-extensions
Last synced: about 1 month ago
JSON representation
Selectize.
- Host: GitHub
- URL: https://github.com/yii2-extensions/selectize
- Owner: yii2-extensions
- License: mit
- Created: 2023-11-19T11:38:00.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-28T06:56:56.000Z (about 2 years ago)
- Last Synced: 2025-06-20T09:46:12.768Z (9 months ago)
- Topics: selectize, widget, yii2, yii2-extensions
- Language: PHP
- Homepage:
- Size: 45.9 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
Selectize.
## Installation
The preferred way to install this extension is through [composer](https://getcomposer.org/download/).
Either run
```shell
composer require --prefer-dist yii2-extensions/selectize:^0.1
```
or add
```json
"yii2-extensions/selectize": "^0.1"
```
to the require section of your `composer.json` file.
## Usage
### Dropdown list
```php
use Yii2\Extension\Selectize\Selectize;
Selectize::widget(
[
'attribute' => 'tags',
'items' => ['foo', 'bar'],
'model' => new SelectizeModel(), // your model
],
);
```
### Text input
```php
use Yii2\Extension\Selectize\Selectize;
Selectize::widget(
[
'attribute' => 'tags',
'items' => ['foo', 'bar'],
'model' => new SelectizeModel(), // your model
'type' => Selectize::TYPE_TEXT, // `Selectize::TYPE_SELECT`, `Selectize::TYPE_TEXT`
],
);
```
### Properties of the widget
| Property | Type | Description | Default |
|----------------|---------------|----------------------------------------------------------------------------------|--------------------------|
| `attribute` | `string` | The attribute associated with this widget. | `null` |
| `clientOptions`| `array` | The options for the underlying Selectize JS plugin. | `[]` |
| `items` | `array` | Items to be displayed in the dropdown list. | `[]` |
| `loadUrl` | `string` | The URL that will return JSON data. | `null` |
| `model` | `Model` | The data model that this widget is associated with. | `null` |
| `options` | `array` | The HTML attributes for the widget container tag. | `[]` |
| `queryParam` | `string` | The name of the parameter that will be sent to the server with the search query. | `query` |
| `type` | `string` | The type of the widget. | `Selectize::TYPE_SELECT` |
## Quality code
[](https://github.com/yii2-extensions/selectize/actions/workflows/static.yml)
[](https://github.com/yii2-extensions/selectize/actions/workflows/static.yml)
[](https://github.styleci.io/repos/720718108?branch=main)
## Support versions Yii2
[](https://github.com/yiisoft/yii2/tree/2.0.49.3)
[](https://github.com/yiisoft/yii2/tree/2.2)
## Testing
[Check the documentation testing](docs/testing.md) to learn about testing.
## Our social networks
[](https://twitter.com/Terabytesoftw)
## License
The MIT License. Please see [License File](LICENSE) for more information.