phloxcz/forms-combobox

Searchable ComboBox form control for Nette Framework with AJAX-powered Selection datasource.

Maintainers

Package info

github.com/phloxcz/forms-combobox

pkg:composer/phloxcz/forms-combobox

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-03-28 17:48 UTC

This package is auto-updated.

Last update: 2026-04-28 18:01:01 UTC


README

Searchable ComboBox form control for Nette Framework backed by Nette\Database\Table\Selection.

Opens with the first N records on focus, filters via AJAX as the user types, and correctly pre-fills the label when opening an edit form – without an extra AJAX round-trip, even for a record deep in the dataset. Ships with built-in Bootstrap 5 and Tailwind CSS themes and full keyboard navigation.

composer require phloxcz/forms-combobox

Quickstart

1. Register the DI extension

# config/common.neon
extensions:
    combobox: Phlox\Forms\ComboBox\ComboBoxExtension

2. Include assets

<link rel="stylesheet" href="{$basePath}/vendor/phloxcz/forms-combobox/assets/combobox.css">
<script src="{$basePath}/vendor/phloxcz/forms-combobox/assets/combobox.js" defer></script>

3. Add the field to your form

use Phlox\Forms\ComboBox\ComboBoxInput;

$form->addComboBox('countryId', 'Country', $this->link('searchCountry!'))
     ->setSelection($this->db->table('countries'), 'id', 'name')
     ->setLimit(30)
     ->setTheme(ComboBoxInput::THEME_BOOTSTRAP);

4. Add a search signal to your presenter

public function handleSearchCountry(string $q = ''): void
{
    $this->sendJson($this['form']['countryId']->fetchData($q));
}

5. Render the field in Latte

{label countryId /}
{input countryId}

Documentation

Full documentation is in docs/README.md.

Requirements

  • PHP 8.1+
  • Nette Framework 3.1+ (nette/application, nette/forms, nette/database, nette/di)

License

MIT