PHPackages                             ui-awesome/html-field - 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. ui-awesome/html-field

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

ui-awesome/html-field
=====================

Form field widget for PHP: renders form controls bound to a form model with label, hint, error, and validation state handling, plus an immutable semantic control factory for application-scoped config recipes.

0.1.0(2w ago)12BSD-3-ClausePHPPHP ^8.3CI passing

Since Jul 31Pushed 2w ago1 watchersCompare

[ Source](https://github.com/ui-awesome/html-field)[ Packagist](https://packagist.org/packages/ui-awesome/html-field)[ RSS](/packages/ui-awesome-html-field/feed)WikiDiscussions main Synced 2w ago

READMEChangelogDependencies (18)Versions (6)Used By (0)

 [ ![UI Awesome](https://raw.githubusercontent.com/ui-awesome/.github/refs/heads/main/logo/ui_awesome.png) ](https://github.com/ui-awesome/html-field)

Html Field
==========

[](#html-field)

 [ ![PHPUnit](https://camo.githubusercontent.com/fcce68799b26f67a79a106394316bc3225ea354c89ca337270e49b9a2fdc81bc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f75692d617765736f6d652f68746d6c2d6669656c642f6275696c642e796d6c3f7374796c653d666f722d7468652d6261646765266c6162656c3d504850556e6974266c6f676f3d676974687562) ](https://github.com/ui-awesome/html-field/actions/workflows/build.yml) [ ![Mutation Testing](https://camo.githubusercontent.com/fb8088729a716ab9ef0c24785a9ee02381e9527f5ba04f0879d0b0260305e35a/68747470733a2f2f696d672e736869656c64732e696f2f656e64706f696e743f7374796c653d666f722d7468652d62616467652675726c3d687474707325334125324625324662616467652d6170692e737472796b65722d6d757461746f722e696f2532466769746875622e636f6d25324675692d617765736f6d6525324668746d6c2d6669656c642532466d61696e) ](https://dashboard.stryker-mutator.io/reports/github.com/ui-awesome/html-field/main) [ ![PHPStan](https://camo.githubusercontent.com/b500c89fd6602bc5bee8a91d159f94ce2943b0b6fb00243dec76dc3fc7c40682/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f75692d617765736f6d652f68746d6c2d6669656c642f7374617469632e796d6c3f7374796c653d666f722d7468652d6261646765266c6162656c3d5048505374616e266c6f676f3d676974687562) ](https://github.com/ui-awesome/html-field/actions/workflows/static.yml) [ ![Security](https://camo.githubusercontent.com/244c889c7debf30b6430e94df9a75fd88e437760bfd42a0badc05a5a6d566db9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f75692d617765736f6d652f68746d6c2d6669656c642f73656375726974792e796d6c3f7374796c653d666f722d7468652d6261646765266c6162656c3d5365637572697479266c6f676f3d676974687562) ](https://github.com/ui-awesome/html-field/actions/workflows/security.yml)

 **A fluent, immutable PHP library for rendering form fields bound to a form model.**
 *Labels, hints, errors, and controls composed through application-scoped configuration.*

Features
--------

[](#features)

  ![Feature Overview](./docs/svgs/features.svg)### Installation

[](#installation)

```
composer require ui-awesome/html-field:^0.1
```

### Quick start

[](#quick-start)

#### Render a field bound to a form model

[](#render-a-field-bound-to-a-form-model)

The field resolves the `id`, `name`, and `label` from the form model and renders a text input by default.

```
use App\Model\BasicForm;
use UIAwesome\Html\Field\Field;

echo Field::tag()
    ->formModel(new BasicForm())
    ->property('username')
    ->render();
```

Html output:

```

    Username

```

#### Hints and validation errors

[](#hints-and-validation-errors)

Hints link to the input through `aria-describedby`; property errors render after the control.

```
use App\Model\BasicForm;
use UIAwesome\Html\Field\Field;

$form = new BasicForm();
$form->addError('username', 'Username is required.');

echo Field::tag()
    ->formModel($form)
    ->property('username')
    ->hintContent('Choose a unique username.')
    ->render();
```

Html output:

```

    Username

      Choose a unique username.

      Username is required.

```

#### Replace the control and style the container

[](#replace-the-control-and-style-the-container)

Any form control can replace the default input; the form model field config is applied to the replacement.

```
use App\Model\BasicForm;
use UIAwesome\Html\Field\Field;
use UIAwesome\Html\Form\InputEmail;

echo Field::tag()
    ->formModel(new BasicForm())
    ->property('username')
    ->input(InputEmail::tag())
    ->containerClass('form-group')
    ->render();
```

Html output:

```

    Username

```

#### Semantic control factory

[](#semantic-control-factory)

`Field` selects controls through `ControlFactory` and applies application-scoped recipes to the field, container, control-specific input container and label, control, hint, error, prefix, and suffix contexts. The package does not select a theme: replace `$theme` with any `ThemeInterface` implementation, such as `Bootstrap5Theme` or `TailwindTheme`.

```
use UIAwesome\Html\Core\Config\Config;
use UIAwesome\Html\Field\Factory\ControlFactory;
use UIAwesome\Html\Field\Field;

$config = new Config(theme: $theme, factory: new ControlFactory());

echo Field::tag()
    ->config($config)
    ->control('email')
    ->formModel($form)
    ->property('email')
    ->render();
```

The default registry supports `checkbox`, `checkbox-list`, `email`, `password`, `radio`, `radio-list`, `select`, `text`, and `textarea`. Registrations are immutable — derive a factory with `with()` to replace or extend them.

`Select` and its typed `Option` objects come from `ui-awesome/html`: compose the control there and the field passes the resolved model value to `Select::value()`.

`CheckboxList`, `RadioList`, and `ChoiceItem` also come from `ui-awesome/html`; `Field` supplies their checked values, name, validation state, label, hint, and errors. See the usage guide for examples, slot contexts, and recipe methods.

#### Strict field configurations

[](#strict-field-configurations)

Form model field configurations are applied through the core config applier in strict mode, once per render, against the control the field finally resolves — so the fluent call order never changes the outcome. An entry naming a method the resolved control does not expose throws `ConfigException` instead of being skipped, so typos such as `maxlenght`fail at render time. The model binding runs first and the config last, so entries such as `value`, `id`, `name`, `checked`, and `placeholder` act as explicit per-property overrides rather than being silently overwritten. See the [upgrade guide](UPGRADE.md) for the precedence rules and supported entry shapes.

Documentation
-------------

[](#documentation)

For detailed usage, testing, and quality workflows.

- [Testing Guide](docs/testing.md)

Package information
-------------------

[](#package-information)

[![PHP](https://camo.githubusercontent.com/f04357fef9ebcd99ed76d5414552bcd1ce849df0ee1d4faf8e991f54c966d508/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f253345253344382e332d3737374242342e7376673f7374796c653d666f722d7468652d6261646765266c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://www.php.net/releases/8.3/en.php)[![Latest Stable Version](https://camo.githubusercontent.com/16aca4eb4339dbda513e6cbc5c40d8e4cde53442082c11b5a78fa8c6af9bc3fb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f75692d617765736f6d652f68746d6c2d6669656c642e7376673f7374796c653d666f722d7468652d6261646765266c6f676f3d7061636b6167697374266c6f676f436f6c6f723d7768697465266c6162656c3d537461626c65)](https://packagist.org/packages/ui-awesome/html-field)[![Total Downloads](https://camo.githubusercontent.com/4452214a3ff53f912ad2df8cc0e7b1fd509536ed6ef300ec77354678439daf88/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f75692d617765736f6d652f68746d6c2d6669656c642e7376673f7374796c653d666f722d7468652d6261646765266c6f676f3d636f6d706f736572266c6f676f436f6c6f723d7768697465266c6162656c3d446f776e6c6f616473)](https://packagist.org/packages/ui-awesome/html-field)

Project status
--------------

[](#project-status)

[![Codecov](https://camo.githubusercontent.com/b4a9220e94281a892304fc9d195ed4bd6035f4832df2f5efcfc6949ee29b625d/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f75692d617765736f6d652f68746d6c2d6669656c642e7376673f7374796c653d666f722d7468652d6261646765266c6f676f3d636f6465636f76266c6f676f436f6c6f723d7768697465266c6162656c3d436f766572616765)](https://codecov.io/github/ui-awesome/html-field)[![PHPStan Level Max](https://camo.githubusercontent.com/b1aeb44257ce46737d1787123b534aab9dded28219f828e4ae13a1e3b460f53c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d4c6576656c2532304d61782d3446354439352e7376673f7374796c653d666f722d7468652d6261646765266c6f676f3d676974687562266c6f676f436f6c6f723d7768697465)](https://github.com/ui-awesome/html-field/actions/workflows/static.yml)[![Quality](https://camo.githubusercontent.com/1009539cfdeeaf29bd8cc7a675d73785fb3640ad79f2444ee9c240fbfd3e21d2/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f75692d617765736f6d652f68746d6c2d6669656c642f7175616c6974792e796d6c3f7374796c653d666f722d7468652d6261646765266c6162656c3d5175616c697479266c6f676f3d676974687562)](https://github.com/ui-awesome/html-field/actions/workflows/quality.yml)[![StyleCI](https://camo.githubusercontent.com/2e44ba381d6c9ab95b548566772bd17337dc56f8a6a646974bf7277720e5be9d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5374796c6543492d5061737365642d3434434331312e7376673f7374796c653d666f722d7468652d6261646765266c6f676f3d676974687562266c6f676f436f6c6f723d7768697465)](https://github.styleci.io/repos/773914929?branch=main)

Our social networks
-------------------

[](#our-social-networks)

[![Follow on X](https://camo.githubusercontent.com/332c1b1e043dfb940b95825f7863dc473f6924ddacdd6738cbbbba08f49e1862/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f2d466f6c6c6f772532306f6e253230582d3144413146322e7376673f7374796c653d666f722d7468652d6261646765266c6f676f3d78266c6f676f436f6c6f723d7768697465266c6162656c436f6c6f723d303030303030)](https://x.com/Terabytesoftw)

License
-------

[](#license)

[![License](https://camo.githubusercontent.com/680c8d62ba2d5a71d7099b6e81114fb0b22d99086c121fd178e1149afc669d44/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4253442d2d332d2d436c617573652d627269676874677265656e2e7376673f7374796c653d666f722d7468652d6261646765266c6f676f3d6f70656e736f75726365696e6974696174697665266c6f676f436f6c6f723d7768697465266c6162656c436f6c6f723d353535353535)](LICENSE)

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance97

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 91.7% 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

Unknown

Total

1

Last Release

17d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/524d2b46690f41fce7188d369488a35e7624e6c5a264d82aacd08548bfd156ab?d=identicon)[terabytesoftw](/maintainers/terabytesoftw)

---

Top Contributors

[![terabytesoftw](https://avatars.githubusercontent.com/u/42547589?v=4)](https://github.com/terabytesoftw "terabytesoftw (11 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

---

Tags

html-fieldphpui-awesomephphtmlwidgetui-awesomeform-fieldhtml-fieldform-modelcontrol-factory

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/ui-awesome-html-field/health.svg)

```
[![Health](https://phpackages.com/badges/ui-awesome-html-field/health.svg)](https://phpackages.com/packages/ui-awesome-html-field)
```

###  Alternatives

[artem_c/emmet

emmet implementation for php

141.8k](/packages/artem-c-emmet)

PHPackages © 2026

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