PHPackages                             rickselby/laravel-form-components - 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. rickselby/laravel-form-components

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

rickselby/laravel-form-components
=================================

Blade components to simplify form creation.

v4.3.0(2y ago)45.0k3[1 PRs](https://github.com/rickselby/laravel-form-components/pulls)MITPHPCI passing

Since Jan 17Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/rickselby/laravel-form-components)[ Packagist](https://packagist.org/packages/rickselby/laravel-form-components)[ RSS](/packages/rickselby-laravel-form-components/feed)WikiDiscussions main Synced today

READMEChangelog (10)Dependencies (4)Versions (29)Used By (0)

Laravel Form Components
=======================

[](#laravel-form-components)

[![Software License](https://camo.githubusercontent.com/074b89bca64d3edc93a1db6c7e3b1636b874540ba91d66367c0e5e354c56d0ea/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e737667)](LICENSE)[![Packagist Version](https://camo.githubusercontent.com/9d73564d126767b7e6a895cbb7d7db78f62b38a269fc767a07aea0a5c456092e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7269636b73656c62792f6c61726176656c2d666f726d2d636f6d706f6e656e7473)](https://camo.githubusercontent.com/9d73564d126767b7e6a895cbb7d7db78f62b38a269fc767a07aea0a5c456092e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7269636b73656c62792f6c61726176656c2d666f726d2d636f6d706f6e656e7473)

Built around [Bootstrap 4](https://getbootstrap.com/docs/4.0/), these are blade components for form fields to speed up form creation.

...as long as you use horizontal forms, as I do. With my layout. I might consider some more customization in a later version, if it's not too difficult.

I'm using [spatie/laravel-html](https://github.com/spatie/laravel-html)for generating each input; this has the advantage of handling old data if a form submission fails, or using values from a model. See [the documentation](https://docs.spatie.be/laravel-html/v2/introduction).

Compatibility Chart
-------------------

[](#compatibility-chart)

Laravel Form ComponentsLaravelPHP**4.x**8.x-9.x8.0+3.x6.x-8.x7.3-8.02.x5.4-5.87.1+1.x5.4-5.77.0+Installing
----------

[](#installing)

Require the project using [Composer](https://getcomposer.org):

```
$ composer require rickselby/laravel-form-components
```

Laravel 5.5+ will auto-discover the package.

For Laravel 5.4, in `config/app.php`, add this line to the `providers` array:

```
RickSelby\Laravel\FormComponents\FormComponentsProvider::class,

```

### Styles

[](#styles)

I wasn't happy with the layout of checkboxes, and need to add a class for some additional padding. This can be published to `public/vendor/rickselby/laravel-form-components/form_components.css`:

```
./artisan vendor:publish --provider="RickSelby\Laravel\FormComponents\FormComponentsProvider" --tag="public"

```

Alternatively, you can include the `scss` source if you're using Laravel Mix or similar. In your `app.scss`, add:

```
@import "vendor/rickselby/laravel-form-components/src/resources/assets/sass/form_components";

```

*(I'm not sure I'm a big fan of publishing a front-end requirement through composer, but it seems to fit in this case).*

Usage
-----

[](#usage)

Simple fields can be added using `@include`:

```
@include('fc::checkbox', ['label' => 'Is active?', 'name' => 'active'])
@include('fc::date', ['label' => 'Date of birth', 'name' => 'birthday'])
@include('fc::file', ['label' => 'Your face', 'name' => 'profile'])
@include('fc::number', ['label' => 'Number of feet', 'name' => 'feet'])
@include('fc::select', ['label' => 'Country', 'name' => 'country', 'options' => $options])
@include('fc::static', ['label' => 'Something you cannot change', 'name' => 'static'])
@include('fc::text', ['label' => 'Name', 'name' => 'name'])
@include('fc::textarea', ['label' => 'Personal statement', 'name' => 'statement'])

```

By using `@component` instead, you can use `@slot` to define the values, which can be preferable for more complicated values; for example, those with HTML:

```
@component('fc::text', ['name' => 'name'])
    @slot('label')
        Label with HTML
    @endslot
@endcomponent

```

You can mix-and-match passing data using an array and slots as best fits your need. If you only use an array, you can use `@include` instead of `@component` and drop the `@endcomponent`.

[Help text](https://getbootstrap.com/docs/4.0/components/forms/#help-text)is supported:

```
@component('fc::text', ['label' => 'Name', 'name' => 'name'])
    @slot('help')
        This should be your name.
    @endslot
@endcomponent

```

Default values can be passed, too:

```
@include('fc::number', ['label' => 'Number of feet', 'name' => 'feet', 'value' => 2])

```

As can placeholders:

```
@include('fc::text', ['label' => 'Name', 'name' => 'name', 'placeholder' => 'Your name'])

```

Classes can be added to the inputs; you must pass an array:

```
@include('fc::text', ['label' => 'Name', 'name' => 'name', 'class' => ['a-name']])

```

So can data attributes, in a similar manner

```
@include('fc::text', ['label' => 'Name', 'name' => 'name', 'data' => ['type', 'first']])

```

Validation errors are shown automatically based on the field name, thanks to the `.invalid-feedback` class.

### Date Picker

[](#date-picker)

```
@include('fc::datepicker', ['label' => 'Date of birth', 'name' => 'birthday'])

```

Date picker is just a text field with the class `date-picker`, which can then have whatever (probably javascript) applied to it to convert it to something more functional.

### Submit button

[](#submit-button)

The submit button is intended to be used with `@component`, as it only has one parameter:

```
@component('fc::submit')
    Submit this form
@endcomponent

```

Overriding
----------

[](#overriding)

Laravel allows overriding of package views. Create the directory `resources/views/vendor/fc`; then create any views you wish to override.

Extending
---------

[](#extending)

Custom fields can be added by extending the `fc::layout.field` template. Ensure the `$label`, `$name` and `$help` attributes are passed through. As an example, this is how the `text` field could be implemented:

```
@component('fc::layout.field', ['label' => $label, 'name' => $name, 'help' => $help ?? null])
    {{ html()->text($name, $value ?? null)->placeholder($placeholder ?? null)->class(['form-control', 'is-invalid' => $errors->has($name)]) }}
@endcomponent

```

There are more available settings in the `fc::layout.field` template for more customisation.

License
-------

[](#license)

Laravel Form Components is licensed under [The MIT License (MIT)](LICENSE).

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance48

Moderate activity, may be stable

Popularity24

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity74

Established project with proven stability

 Bus Factor1

Top contributor holds 96.1% 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 ~90 days

Recently: every ~130 days

Total

26

Last Release

789d ago

Major Versions

v1.11 → v2.02019-07-04

v2.0.1 → v3.0.02022-10-08

v3.2.0 → v4.0.02022-10-08

### Community

Maintainers

![](https://www.gravatar.com/avatar/6cc8910980f053d8ceb2e9d938427cf03ae509884763a10f916b4eef5591934f?d=identicon)[rickselby](/maintainers/rickselby)

---

Top Contributors

[![rickselby](https://avatars.githubusercontent.com/u/1564517?v=4)](https://github.com/rickselby "rickselby (98 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (1 commits)")

---

Tags

bootstrap4formslaravel

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/rickselby-laravel-form-components/health.svg)

```
[![Health](https://phpackages.com/badges/rickselby-laravel-form-components/health.svg)](https://phpackages.com/packages/rickselby-laravel-form-components)
```

###  Alternatives

[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[arrilot/laravel-widgets

A powerful alternative to view composers. Asynchronous widgets, reloadable widgets, console generator, caching - everything you can think of.

1.1k4.6M103](/packages/arrilot-laravel-widgets)[illuminate/view

The Illuminate View package.

13144.9M1.7k](/packages/illuminate-view)[moonshine/moonshine

Laravel administration panel

1.3k217.1k59](/packages/moonshine-moonshine)[ryangjchandler/blade-capture-directive

Create inline partials in your Blade templates with ease.

8222.2M12](/packages/ryangjchandler-blade-capture-directive)[tallstackui/tallstackui

TallStackUI is a powerful suite of Blade components that elevate your workflow of Livewire applications.

703141.0k7](/packages/tallstackui-tallstackui)

PHPackages © 2026

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