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

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.

Awesome Lists containing this project

README

          





Selectize.





php-version


PHPUnit


PHPUnit


Codecov


Infection

## 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

[![static-analysis](https://github.com/yii2-extensions/selectize/actions/workflows/static.yml/badge.svg)](https://github.com/yii2-extensions/selectize/actions/workflows/static.yml)
[![phpstan-level](https://img.shields.io/badge/PHPStan%20level-7-blue)](https://github.com/yii2-extensions/selectize/actions/workflows/static.yml)
[![StyleCI](https://github.styleci.io/repos/720718108/shield?branch=main)](https://github.styleci.io/repos/720718108?branch=main)

## Support versions Yii2

[![Yii20](https://img.shields.io/badge/Yii2%20version-2.0-blue)](https://github.com/yiisoft/yii2/tree/2.0.49.3)
[![Yii22](https://img.shields.io/badge/Yii2%20version-2.2-blue)](https://github.com/yiisoft/yii2/tree/2.2)

## Testing

[Check the documentation testing](docs/testing.md) to learn about testing.

## Our social networks

[![Twitter](https://img.shields.io/badge/twitter-follow-1DA1F2?logo=twitter&logoColor=1DA1F2&labelColor=555555?style=flat)](https://twitter.com/Terabytesoftw)

## License

The MIT License. Please see [License File](LICENSE) for more information.