PHPackages                             bastinald/laravel-livewire-forms - 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. bastinald/laravel-livewire-forms

ActiveLibrary

bastinald/laravel-livewire-forms
================================

Laravel Livewire form component with declarative Bootstrap 5 fields and buttons.

1.1.1(4y ago)5250626[4 issues](https://github.com/bastinald/laravel-livewire-forms/issues)[3 PRs](https://github.com/bastinald/laravel-livewire-forms/pulls)1MITPHP

Since May 9Pushed 3y ago3 watchersCompare

[ Source](https://github.com/bastinald/laravel-livewire-forms)[ Packagist](https://packagist.org/packages/bastinald/laravel-livewire-forms)[ Docs](https://github.com/bastinald/laravel-livewire-forms)[ RSS](/packages/bastinald-laravel-livewire-forms/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (2)Versions (11)Used By (1)

Laravel Livewire Forms
----------------------

[](#laravel-livewire-forms)

Laravel Livewire form component with declarative Bootstrap 5 fields and buttons.

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

[](#requirements)

- Bootstrap 5

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

[](#installation)

```
composer require bastinald/laravel-livewire-forms
```

Usage
-----

[](#usage)

Make a new form:

```
php artisan make:form users.create-user-form
```

Declare fields:

```
public function fields()
{
    return [
        Input::make('name', 'Name'),
        Input::make('email', 'Email')->type('email'),
        Input::make('password', 'Password')->type('password'),
    ];
}
```

Declare buttons:

```
public function buttons()
{
    return [
        Button::make('Create User')->click('createUser'),
        Button::make('Cancel', 'secondary')->url('/'),
    ];
}
```

Declare rules:

```
public function rules()
{
    return [
        'name' => ['required', 'string', 'max:255'],
        'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
        'password' => ['required', 'string', 'min:8'],
    ];
}
```

Declare an action (notice the use of `->click('createUser')` in the button example above:

```
public function createUser()
{
    $this->validate();

    User::create([
        'name' => $this->data('name'),
        'email' => $this->data('email'),
        'password' => Hash::make($this->data('password')),
    ]);

    return redirect('/');
}
```

Full Page Forms
---------------

[](#full-page-forms)

Create a full page form by specifying a `title`, `layout` and `route` to use:

```
class Login extends FormComponent
{
    public $title = 'Login';
    public $layout = 'layouts.card';

    public function route()
    {
        return Route::get('/login', static::class)
            ->name('login')
            ->middleware('guest');
    }
```

The `route` method is made available by using my [laravel-livewire-routes](https://github.com/bastinald/laravel-livewire-routes) package.

Setting Initial Data
--------------------

[](#setting-initial-data)

You can set the initial form data / defaults via the `data` array property in your component `mount` method:

```
class UpdateUserForm extends FormComponent
{
    public $title = 'Update User';

    public function route()
    {
        return Route::get('/users/update/{user}', static::class)
            ->name('users.update')
            ->middleware('auth');
    }

    public function mount(User $user)
    {
        $this->data = $user->toArray();
    }
```

Accessing Data
--------------

[](#accessing-data)

Use the `data` method in the component to access current form data (you can use dot notation for array values):

```
public function createUser()
{
    User::create([
        'name' => $this->data('name'),
        'email' => $this->data('email'),
        'likes_turtles' => $this->data('answers.likes_turtles'),
    ]);
}
```

Data Binding
------------

[](#data-binding)

Most fields allow you to change the way livewire binds data via helper methods that are chained to fields e.g.:

```
Input::make('name', 'Name'), // defaults to defer
Input::make('name', 'Name')->instant(), // bind on keyup
Input::make('name', 'Name')->defer(), // bind on action
Input::make('name', 'Name')->lazy(), // bind on change
Input::make('name', 'Name')->debounce(500), // bind after 500ms delay
```

Sizing
------

[](#sizing)

Many fields also allow you to specify a size for the input e.g.:

```
Input::make('name', 'Name'), // defaults to normal sizing
Input::make('name', 'Name')->small(), // small sizing
Input::make('name', 'Name')->large(), // large sizing
```

Disabling
---------

[](#disabling)

Some fields allow you to disable or set them to readonly, and even plaintext for inputs:

```
Input::make('name', 'Name')->disabled(),
Input::make('name', 'Name')->readonly(),
Input::make('name', 'Name')->plaintext(),
```

Helper Text
-----------

[](#helper-text)

Specify helper text for a field by using the `help` method:

```
Input::make('name', 'Name')->help('Please tell us your name!'),
```

Available Fields
----------------

[](#available-fields)

### Alert `($message, $style = 'success')`

[](#alert-message-style--success)

An alert box.

```
Alert::make('It worked!'),
Alert::make('Something bad happened.', 'danger'),
Alert::make('Something else happened.')->dismissible(),
```

The `$style` parameter accepts a bootstrap alert style e.g. `success`, `danger`, `primary`, etc. Use the `dismissible` method to make the alert dismissible.

Available methods: `dismissible`

### Arrayable `($name, $label = null)`

[](#arrayable-name-label--null)

An array of fields.

```
Arrayable::make('locations', 'Locations')->fields([
    Input::make('city')->placeholder('City'),
    Select::make('state')->placeholder('State')->options(['FL', 'TX']),
]),
```

Available methods: `fields`, `help`, `disabled`

### Button `($label = 'Submit', $style = 'primary')`

[](#button-label--submit-style--primary)

A button used for actions and links.

```
Button::make('Register')->click('register'),
Button::make('Already registered?', 'secondary')->route('login'),
Button::make('Go back home', 'link')->url('/'),
```

The `$style` parameter accepts a bootstrap button style e.g. `primary`, `outline-secondary`, `link`, etc. Use the `block` method to make a button full width.

Available methods: `block`, `click`, `href`, `route`, `url`

### Checkbox `($name, $label)`

[](#checkbox-name-label)

A checkbox field.

```
Checkbox::make('accept', 'I accept the terms'),
Checkbox::make('accept', 'I accept')->help('Please accept our terms'),
Checkbox::make('active', 'This user is active')->switch(),
```

Use the `switch` method to style the checkbox as a switch.

Available methods: `switch`, `help`, `instant`, `defer`, `lazy`, `debounce`, `disabled`

### Checkboxes `($name, $label = null)`

[](#checkboxes-name-label--null)

An array of checkbox fields.

```
Checkboxes::make('colors', 'Colors')->options(['Red', 'Green', 'Blue']),
```

Available methods: `options`, `switch`, `help`, `instant`, `defer`, `lazy`, `debounce`, `disabled`

### Color `($name, $label = null)`

[](#color-name-label--null)

A color picker field.

```
Color::make('hair_color', 'Hair Color'),
```

Available methods: `small`, `large`, `help`, `instant`, `defer`, `lazy`, `debounce`, `disabled`, `readonly`

### Conditional

[](#conditional)

A statement used to conditionally show fields.

```
Conditional::if($this->data('color') == 'green', [
    Input::make('green', 'Green'),
])->elseif($this->data('color') == 'blue', [
    Input::make('blue', 'Blue'),
])->else([
    Input::make('red', 'Red'),
]),
```

Available methods: `if`, `elseif`, `else`

### DynamicComponent `($name, $attrs = [])`

[](#dynamiccomponent-name-attrs--)

A field used to display dynamic third-party components.

```
DynamicComponent::make('honey'),
DynamicComponent::make('honey', ['recaptcha' => true]),
```

This would translate to `` and `` in your form.

### File `($name, $label = null)`

[](#file-name-label--null)

A file upload field.

```
File::make('avatar', 'Avatar'),
File::make('photos', 'Photos')->multiple(),
File::make('documents', 'Documents')->multiple()->disk('s3'),
```

Use the `multiple` method to allow multiple file uploads. Optionally specify the filesystem disk to use via the `disk` method (used for linking to files, defaults to the filesystem config `default`).

Available methods: `disk`, `multiple`, `help`, `disabled`

### Input `($name, $label = null)`

[](#input-name-label--null)

An input field.

```
Input::make('name', 'Name'),
Input::make('phone')->placeholder('Phone')->type('tel'),
Input::make('email', 'Email')->type('email')->large(),
Input::make('price', 'Price')->type('number')->append('$')->prepend('.00'),
```

The `type` method accepts a standard HTML input type. As with other inputs, use `small` or `large` to resize an input. Input fields also support appends/prepends, and even plaintext.

Available methods: `small`, `large`, `help`, `instant`, `defer`, `lazy`, `debounce`, `disabled`, `readonly`, `placeholder`, `type`, `append`, `prepend`, `plaintext`

### Radio `($name, $label = null)`

[](#radio-name-label--null)

A radio field.

```
Radio::make('gender', 'Gender')->options(['Male', 'Female']),
```

Available methods: `options`, `switch`, `help`, `instant`, `defer`, `lazy`, `debounce`, `disabled`

### Select `($name, $label = null)`

[](#select-name-label--null)

A select dropdown field.

```
Select::make('color', 'Color')->options(['Red', 'Green', 'Blue']),
Select::make('color', 'Color')->options([
    '#ff0000' => 'Red',
    '#00ff00' => 'Green',
    '#0000ff' => 'Blue',
])->instant(),
Select::make('user_id', 'User')->options(User::pluck('name', 'id')->toArray()),
```

Available methods: `options`, `small`, `large`, `help`, `instant`, `defer`, `lazy`, `debounce`, `disabled`, `placeholder`

### Textarea `($name, $label = null)`

[](#textarea-name-label--null)

A textarea field.

```
Input::make('bio', 'Biography'),
Input::make('bio', 'Biography')->rows(5),
```

Available methods: `small`, `large`, `help`, `instant`, `defer`, `lazy`, `debounce`, `disabled`, `readonly`, `placeholder`, `rows`

### View `($name, $data = [])`

[](#view-name-data--)

Used to render a custom Blade view inside the form.

```
View::make('custom-view', ['hello' => 'world']),
```

###  Health Score

33

—

LowBetter than 74% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

10

Last Release

1822d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/82109804?v=4)[bastinald](/maintainers/bastinald)[@bastinald](https://github.com/bastinald)

---

Top Contributors

[![bastinald](https://avatars.githubusercontent.com/u/82109804?v=4)](https://github.com/bastinald "bastinald (15 commits)")

### Embed Badge

![Health badge](/badges/bastinald-laravel-livewire-forms/health.svg)

```
[![Health](https://phpackages.com/badges/bastinald-laravel-livewire-forms/health.svg)](https://phpackages.com/packages/bastinald-laravel-livewire-forms)
```

###  Alternatives

[livewire/volt

An elegantly crafted functional API for Laravel Livewire.

4195.3M84](/packages/livewire-volt)[namu/wirechat

A Laravel Livewire messaging app for teams with private chats and group conversations.

54324.5k](/packages/namu-wirechat)[mhmiton/laravel-modules-livewire

Using Laravel Livewire in Laravel Modules package with automatically registered livewire components for every modules.

236409.6k9](/packages/mhmiton-laravel-modules-livewire)[ramonrietdijk/livewire-tables

Dynamic tables for models with Laravel Livewire

21147.4k](/packages/ramonrietdijk-livewire-tables)[lakm/laravel-comments

Integrate seamless commenting functionality into your Laravel project.

40012.9k1](/packages/lakm-laravel-comments)[marcorieser/statamic-livewire

A Laravel Livewire integration for Statamic.

2381.5k10](/packages/marcorieser-statamic-livewire)

PHPackages © 2026

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