PHPackages                             kartik-v/yii2-widget-typeahead - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. kartik-v/yii2-widget-typeahead

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

kartik-v/yii2-widget-typeahead
==============================

Enhanced Yii2 wrapper for the Twitter Typeahead plugin (sub repo split from yii2-widgets).

v1.0.4(6y ago)454.8M↓10.4%17[1 issues](https://github.com/kartik-v/yii2-widget-typeahead/issues)9BSD-3-ClauseJavaScript

Since Nov 8Pushed 4y ago2 watchersCompare

[ Source](https://github.com/kartik-v/yii2-widget-typeahead)[ Packagist](https://packagist.org/packages/kartik-v/yii2-widget-typeahead)[ Docs](https://github.com/kartik-v/yii2-widget-typeahead)[ RSS](/packages/kartik-v-yii2-widget-typeahead/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (1)Versions (6)Used By (9)

 [ ![Krajee Logo](https://camo.githubusercontent.com/4addfbb3869c3fc7d79befea4f06d9cf3655a686fb503df0da1d725859cfdef9/687474703a2f2f6b617274696b2d762e6769746875622e696f2f626f6f7473747261702d66696c65696e7075742d73616d706c65732f73616d706c65732f6b72616a65652d6c6f676f2d622e706e67) ](http://demos.krajee.com "Krajee Demos")
 yii2-widget-typeahead ---

 [![Donate](https://camo.githubusercontent.com/0336bc43d88554a3f2d6c74dddf312bc2c65c2eacca70d83ae40f5567098d00e/68747470733a2f2f6b617274696b2d762e6769746875622e696f2f626f6f7473747261702d66696c65696e7075742d73616d706c65732f73616d706c65732f646f6e6174652e706e67)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=DTP3NZQ6G2AYU "Donate via Paypal") [![kartikv](https://camo.githubusercontent.com/0cf29a542375e1a46e84d8bf5805a4e5c0a6ee98b6547ccdc0c55eed49d99c69/68747470733a2f2f63646e2e6275796d6561636f666665652e636f6d2f627574746f6e732f76322f64656661756c742d79656c6c6f772e706e67)](https://www.buymeacoffee.com/kartikv "Buy me a coffee")
========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#------------------------yii2-widget-typeahead------------------)

[![Stable Version](https://camo.githubusercontent.com/72941cdac4f02a9c016cd2012c542c90ce19b6d70cf467b5208dd23b36682cc5/68747470733a2f2f706f7365722e707567782e6f72672f6b617274696b2d762f796969322d7769646765742d7479706561686561642f762f737461626c65)](https://packagist.org/packages/kartik-v/yii2-widget-typeahead)[![Unstable Version](https://camo.githubusercontent.com/b9e41466f2fde42d83697cabaeed180d2c5607c753f0a73fa1cd024556de7a72/68747470733a2f2f706f7365722e707567782e6f72672f6b617274696b2d762f796969322d7769646765742d7479706561686561642f762f756e737461626c65)](https://packagist.org/packages/kartik-v/yii2-widget-typeahead)[![License](https://camo.githubusercontent.com/017a48eca925d966c270e41efef9a0cbacbdaff915a698224ff1d1f6b025de36/68747470733a2f2f706f7365722e707567782e6f72672f6b617274696b2d762f796969322d7769646765742d7479706561686561642f6c6963656e7365)](https://packagist.org/packages/kartik-v/yii2-widget-typeahead)[![Total Downloads](https://camo.githubusercontent.com/006d37eef8f6a0bde9f06663a475f0c6dbe1baf9e61a6ab3bd60cf4a2b7dc8f5/68747470733a2f2f706f7365722e707567782e6f72672f6b617274696b2d762f796969322d7769646765742d7479706561686561642f646f776e6c6f616473)](https://packagist.org/packages/kartik-v/yii2-widget-typeahead)[![Monthly Downloads](https://camo.githubusercontent.com/fd1d14e11a75ef2c8977bec5e3473e16f3b92a0f1e10bfe73b017f1a1c8f02a9/68747470733a2f2f706f7365722e707567782e6f72672f6b617274696b2d762f796969322d7769646765742d7479706561686561642f642f6d6f6e74686c79)](https://packagist.org/packages/kartik-v/yii2-widget-typeahead)[![Daily Downloads](https://camo.githubusercontent.com/97da77662a8195426eb9de21947a0491073d66ba6516c77e478ff671b74c3dbc/68747470733a2f2f706f7365722e707567782e6f72672f6b617274696b2d762f796969322d7769646765742d7479706561686561642f642f6461696c79)](https://packagist.org/packages/kartik-v/yii2-widget-typeahead)

The Typeahead extension is a Yii 2 wrapper widget for for the [Twitter Typeahead.js plugin](http://twitter.github.com/typeahead.js/examples) with certain custom enhancements. The latest release uses the [typeahead.js fork from corejavascript](https://github.com/corejavascript/typeahead.js). The `yii2-widget-typeahead` extension is a jQuery based replacement for text inputs providing search and typeahead functionality. It is inspired by twitter.com's autocomplete search functionality and based on Twitter's typeahead.js, which is described as a fast and fully-featured autocomplete library. The widget is specially styled for Bootstrap 3.x, 4.x, or 5.x. The widget allows graceful degradation to a normal HTML text input, if the browser does not support JQuery. You can also setup model validation rules for the widget like any other field. The extension offers two variations of the widget implementation:

- `TypeaheadBasic`: This widget is a basic implementation of the *typeahead.js* plugin without any suggestion engine. It uses a javascript substring matcher and Regular Expression matching to query and display suggestions. [`VIEW DEMO`](http://demos.krajee.com/widget-details/typeahead-basic)
- `Typeahead`: This widget is an advanced implementation of the *typeahead.js* plugin with the *BloodHound* suggestion engine and the *Handlebars* template compiler. [`VIEW DEMO`](http://demos.krajee.com/widget-details/typeahead)

> NOTE: This extension is a sub repo split of [yii2-widgets](https://github.com/kartik-v/yii2-widgets). The split has been done since 08-Nov-2014 to allow developers to install this specific widget in isolation if needed. One can also use the extension the previous way with the whole suite of [yii2-widgets](http://demos.krajee.com/widgets).

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/). Check the [composer.json](https://github.com/kartik-v/yii2-widget-typeahead/blob/master/composer.json) for this extension's requirements and dependencies. Read this [web tip /wiki](http://webtips.krajee.com/setting-composer-minimum-stability-application/) on setting the `minimum-stability` settings for your application's composer.json.

To install, either run

```
$ php composer.phar require kartik-v/yii2-widget-typeahead "*"

```

or add

```
"kartik-v/yii2-widget-typeahead": "*"

```

to the `require` section of your `composer.json` file.

Latest Release
--------------

[](#latest-release)

> Refer the [CHANGE LOG](https://github.com/kartik-v/yii2-widget-typeahead/blob/master/CHANGE.md) for details on changes to various releases.

Demo
----

[](#demo)

You can refer detailed documentation and demos for [TypeaheadBasic](http://demos.krajee.com/widget-details/typeahead-basic) or [Typeahead](http://demos.krajee.com/widget-details/typeahead) for understanding the usage of the extension.

Usage
-----

[](#usage)

```
use kartik\typeahead\TypeaheadBasic;
use kartik\typeahead\Typeahead;

// TypeaheadBasic usage with ActiveForm and model
echo $form->field($model, 'state_3')->widget(TypeaheadBasic::classname(), [
    'data' => $data,
    'pluginOptions' => ['highlight' => true],
    'options' => ['placeholder' => 'Filter as you type ...'],
]);

// Typeahead usage with ActiveForm and model
echo $form->field($model, 'state_4')->widget(Typeahead::classname(), [
    'dataset' => [
        [
            'local' => $data,
            'limit' => 10
        ]
    ],
    'pluginOptions' => ['highlight' => true],
    'options' => ['placeholder' => 'Filter as you type ...'],
]);
```

License
-------

[](#license)

**yii2-widget-typeahead** is released under the BSD-3-Clause License. See the bundled `LICENSE.md` for details.

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity56

Moderate usage in the ecosystem

Community27

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 82.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~415 days

Total

5

Last Release

2547d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3592619?v=4)[Kartik Visweswaran](/maintainers/kartik-v)[@kartik-v](https://github.com/kartik-v)

---

Top Contributors

[![kartik-v](https://avatars.githubusercontent.com/u/3592619?v=4)](https://github.com/kartik-v "kartik-v (32 commits)")[![bandaot](https://avatars.githubusercontent.com/u/4526370?v=4)](https://github.com/bandaot "bandaot (2 commits)")[![darksnake747](https://avatars.githubusercontent.com/u/2414339?v=4)](https://github.com/darksnake747 "darksnake747 (1 commits)")[![iBotPeaches](https://avatars.githubusercontent.com/u/611784?v=4)](https://github.com/iBotPeaches "iBotPeaches (1 commits)")[![joester89](https://avatars.githubusercontent.com/u/9624366?v=4)](https://github.com/joester89 "joester89 (1 commits)")[![githubjeka](https://avatars.githubusercontent.com/u/874234?v=4)](https://github.com/githubjeka "githubjeka (1 commits)")[![cccaballero](https://avatars.githubusercontent.com/u/3727802?v=4)](https://github.com/cccaballero "cccaballero (1 commits)")

---

Tags

pluginjqueryyii2extensionwidgetformdropdowntypeahead

### Embed Badge

![Health badge](/badges/kartik-v-yii2-widget-typeahead/health.svg)

```
[![Health](https://phpackages.com/badges/kartik-v-yii2-widget-typeahead/health.svg)](https://phpackages.com/packages/kartik-v-yii2-widget-typeahead)
```

###  Alternatives

[kartik-v/yii2-widget-depdrop

Widget that enables setting up dependent dropdowns with nested dependencies (sub repo split from yii2-widgets)

814.9M18](/packages/kartik-v-yii2-widget-depdrop)[kartik-v/yii2-widget-select2

Enhanced Yii2 wrapper for the Select2 jQuery plugin (sub repo split from yii2-widgets).

3279.7M191](/packages/kartik-v-yii2-widget-select2)[kartik-v/yii2-widget-datepicker

Enhanced Yii2 wrapper for the bootstrap datepicker plugin (sub repo split from yii2-widgets).

1097.0M60](/packages/kartik-v-yii2-widget-datepicker)[kartik-v/yii2-widget-datetimepicker

Enhanced Yii2 wrapper for the bootstrap datetimepicker plugin (sub repo split from yii2-widgets)

1036.5M47](/packages/kartik-v-yii2-widget-datetimepicker)[kartik-v/yii2-widget-rating

A Yii2 widget for the simple yet powerful bootstrap-star-rating plugin with fractional rating support (sub repo split from yii2-widgets)

444.1M8](/packages/kartik-v-yii2-widget-rating)[kartik-v/yii2-widget-timepicker

Enhanced Yii2 wrapper for the bootstrap timepicker plugin (sub repo split from yii2-widgets)

404.9M14](/packages/kartik-v-yii2-widget-timepicker)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
