Metadata-Version: 2.4
Name: wtforms-htmx-components
Version: 0.1.0
Summary: Ready-made interactive WTForms fields built on wtforms-htmx.
Keywords: wtforms,htmx,forms,validation,combobox
License-Expression: BSD-3-Clause
License-File: LICENSE.rst
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Requires-Dist: wtforms>=3.3.0,<4
Requires-Dist: wtforms-htmx>=0.1.0
Maintainer: Éloi Rivard
Maintainer-email: Éloi Rivard <eloi@yaal.coop>
Requires-Python: >=3.11
Project-URL: Documentation, https://wtforms-htmx-components.readthedocs.io/
Project-URL: Changes, https://wtforms-htmx-components.readthedocs.io/changes/
Project-URL: Source Code, https://github.com/yaal-coop/wtforms-htmx-components
Project-URL: Issue Tracker, https://github.com/yaal-coop/wtforms-htmx-components/issues
Description-Content-Type: text/markdown

# wtforms-htmx-components

Ready-made interactive [WTForms](https://wtforms.readthedocs.io/) fields
built on [wtforms-htmx](https://github.com/yaal-coop/wtforms-htmx).

**Status: alpha, work in progress.**

Each field packages a recipe of several triggers (typing, suggestions,
pick, store, chip) into a single `FormField` declaration. Available now:
the combobox, single and multi value, strict or with free-form values.

## Installation

```sh
pip install wtforms-htmx-components
```

## Example

```python
from wtforms import SelectChoice
from wtforms import SubmitField
from wtforms_htmx import HtmxForm
from wtforms_htmx_components import ComboboxMultiField


def suggest(query, form):
    q = query.lower()
    return [SelectChoice(tag, tag) for tag in CATALOG if q in tag.lower()]


class TagsForm(HtmxForm):
    tags = ComboboxMultiField("Tags", suggest=suggest)
    save = SubmitField()
```

Run the example app:

```sh
uv sync --group example
uv run python -m examples
```

Then open <http://127.0.0.1:5000/>.

## Links

- Source: <https://github.com/yaal-coop/wtforms-htmx-components>
- Issues: <https://github.com/yaal-coop/wtforms-htmx-components/issues>

## License

BSD-3-Clause. See `LICENSE.rst`.
