PHPackages                             tvaliasek/yabsform - 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. [Templating &amp; Views](/categories/templating)
4. /
5. tvaliasek/yabsform

ActiveLibrary[Templating &amp; Views](/categories/templating)

tvaliasek/yabsform
==================

Another nette forms bootstrap renderer

v0.1.1(11mo ago)088[1 PRs](https://github.com/tvaliasek/yabsform/pulls)MITPHPPHP &gt;= 8.1

Since May 16Pushed 11mo ago1 watchersCompare

[ Source](https://github.com/tvaliasek/yabsform)[ Packagist](https://packagist.org/packages/tvaliasek/yabsform)[ RSS](/packages/tvaliasek-yabsform/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (5)Dependencies (6)Versions (7)Used By (0)

YABSForm - Nette 3 Bootstrap form renderer with custom controls support
=======================================================================

[](#yabsform---nette-3-bootstrap-form-renderer-with-custom-controls-support)

Yet another Bootstrap 4 form renderer and custom form components for [Nette framework](https://nette.org). Inspired by [contributte/forms](https://github.com/contributte/forms), [nextras/forms](https://github.com/nextras/forms) and [Kdyby/BootstrapFormRenderer](https://github.com/Kdyby/BootstrapFormRenderer).

Todo:

- write tests

Requirements
------------

[](#requirements)

- PHP 7.3

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

[](#installation)

Install with composer:

```
composer require tvaliasek/yabsform

```

Register extensions in your \*.neon config.

```
extensions:
    yabsform.controls: YABSForm\DI\FormControlsExtension
    yabsform.formFactory: YABSForm\DI\FormFactoryExtension
    yabsform.formMacros: YABSForm\DI\FormMacrosExtension

```

Usage
-----

[](#usage)

The simplest way is to use provided form factory, which creates Form instance and sets renderer to BootstrapFormRenderer.

```
/* example in presenter */

/**
* @inject
* @var \YABSForm\Factories\BootstrapFormFactory
*/
public $formFactory;

protected function createComponentExampleForm(): Form
{
    $form = $this->formFactory->create();
    /* ... add controls, callbacks etc. */
    return $form;
}

/* example in component or service */

/**
* @var \YABSForm\Factories\BootstrapFormFactory
*/
private $formFactory;

public function __construct(\YABSForm\Factories\BootstrapFormFactory $formFactory)
{
    $this->formFactory = $formFactory
}

```

### Custom methods in renderer

[](#custom-methods-in-renderer)

Renderer provide few methods whose allow common modifications of rendered output.

```
$renderer = $form->getRenderer();

// Sets default css class names for submit inputs
$renderer->setSubmitButtonClassnames('btn-lg btn-primary');

// Sets default css class names for buttons other than submit inputs
$renderer->setButtonClassnames('btn-secondary');

// Disables dismissibility of form errors presented as bootstrap alerts
$renderer->disableDismissibleFormErrors()

// Set globally size of controls
$renderer->setControlSize('lg')

// Set globally columns for labels and for controls (in vertical render mode)
$renderer->setLabelColumns(12, null, null, 4, null)
$renderer->setControlColumns(12, null, null, 8, null)

```

### Custom form macros

[](#custom-form-macros)

This package also provides few custom macros for more control over form layout. All of them are unpaired and does not accept more parameters.

```
{* in latte template *}
{form exampleForm}
    {* renders form errors *}
    {bsErrors}
    {* renders form own errors *}
    {bsOwnErrors}

    {* renders whole form-group with input, feedback and label *}
    {bsPair exampleInput}

    {* renders only label*}
    {bsLabel exampleInput}

    {* renders only input *}
    {bsInput exampleInput}
{/form}

```

### Custom Bootstrap form elements

[](#custom-bootstrap-form-elements)

Available is:

- CustomCheckbox - renderable also as switch
- CustomCheckboxList - renderable also as switches
- CustomMultiSelect
- CustomRadioList
- CustomRange
- CustomSelect
- CustomUpload - see [bootstrap docs](https://getbootstrap.com/docs/4.3/components/forms/#file-browser) for displaying names of selected files
- DatePicker and DateTimePicker is in separated repo here [Nextras Forms Fork](https://github.com/tvaliasek/nextras-forms-fork)

For properly displayed invalid feedback message, you should include this additional style:

```

    .__yabsform-is-invalid ~ .invalid-feedback,
    .custom-range.is-invalid ~ .invalid-feedback,
    .custom-file.is-invalid ~ .invalid-feedback,
    .custom-control.is-invalid ~ .invalid-feedback{
        display: block;
    }

```

Example of usage in form:

```
$form->addCustomCheckbox('switch', 'Custom checkbox switch')
    ->renderAsSwitch(true);
$form->addCustomCheckbox('custom', 'Custom checkbox');

$form->addCustomCheckboxList('customList', 'Custom checkbox list', [
    'first' => 'first item',
    'second' => 'second item',
    'third' => 'third item'
]);
$form->addCustomCheckboxList('customSwitchesList', 'Custom switches checkbox list', [
    'first' => 'first item',
    'second' => 'second item',
    'third' => 'third item'
])->renderAsSwitches(true);

$form->addCustomRadioList('customRadioList', 'Custom radio list', [
    'first' => 'first item',
    'second' => 'second item',
    'third' => 'third item'
]);

$form->addCustomSelect('customSelect', 'Custom select', [
    'first' => 'first item',
    'second' => 'second item',
    'third' => 'third item'
]);

$form->addCustomMultiSelect('customMultiselect', 'Custom multiselect', [
    'first' => 'first item',
    'second' => 'second item',
    'third' => 'third item'
]);

$form->addCustomUpload('customUpload', 'Custom upload')
    ->setBrowseCaption('Procházet');

$form->addCustomRange('customRange', 'Custom range', 0, 2, .5)
    ->setRequired(true);

```

###  Health Score

36

—

LowBetter than 81% of packages

Maintenance54

Moderate activity, may be stable

Popularity9

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 94.4% 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 ~552 days

Total

5

Last Release

340d ago

PHP version history (2 changes)v0.0.1PHP &gt;= 7.3

v0.1.1PHP &gt;= 8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8644946?v=4)[Tomáš Valiašek](/maintainers/tvaliasek)[@tvaliasek](https://github.com/tvaliasek)

---

Top Contributors

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

---

Tags

bootstrapformsnetterenderernetterendererbootstrapForms

### Embed Badge

![Health badge](/badges/tvaliasek-yabsform/health.svg)

```
[![Health](https://phpackages.com/badges/tvaliasek-yabsform/health.svg)](https://phpackages.com/packages/tvaliasek-yabsform)
```

###  Alternatives

[nepada/form-renderer

Latte template based form renderer for Nette forms with full support for Bootstrap 3, 4 &amp; 5.

11251.0k](/packages/nepada-form-renderer)[contributte/forms-bootstrap

Nette extension for Bootstrap forms

211.1M4](/packages/contributte-forms-bootstrap)[tomaj/nette-bootstrap-form

Nette bootstrap form renderer

28440.4k6](/packages/tomaj-nette-bootstrap-form)[nextras/forms-rendering

Rendering helpers for Nette Framework Forms.

1698.4k2](/packages/nextras-forms-rendering)

PHPackages © 2026

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