PHPackages                             flsouto/htwidget - 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. flsouto/htwidget

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

flsouto/htwidget
================

Abstract class for defining form widget types

1.0.2(9y ago)11733PHP

Since Feb 5Pushed 9y agoCompare

[ Source](https://github.com/flsouto/htwidget)[ Packagist](https://packagist.org/packages/flsouto/htwidget)[ RSS](/packages/flsouto-htwidget/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (4)Used By (3)

HtWidget
========

[](#htwidget)

Overview
--------

[](#overview)

This class can be used to define different types of widgets. But what is a widget? A widget is an interactive field/element which has some sort of state and allows users to communicate with a server or a backend. Notice that not all form fields are interactive. A [hidden field](https://github.com/flsouto/hthidden), for instance, even though it has a state, it does not provide any form of direct interaction. A [button](https://github.com/flsouto/htbutton) is also not a widget, in my opinion, because it doesn't allow any complex interaction other than just clicking on it. An input text field or a checkbox, on the other hand, can be considered to be a widget because they do have a state and require some kind of interaction. In this documentation we are going to see how to implement a simple TextField class which inherits from HtWidget.

**Notice:** A lot of functionality is inherited from a more basic abstract class called HtField. If you find difficulties in understanding some of the features being reused here, please refer to [this documentation](https://github.com/flsouto/hthidden).

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

[](#installation)

Run composer:

```
composer require flsouto/htwidget

```

Usage
-----

[](#usage)

Below we are going to implement a simple `TextField` class. Pay attention to it because we are going to use it through out this document in order to learn about all the functionality inherited from `HtWidget`:

```
