Laravel Livewire (TALL-stack) form generator with realtime validation, file uploads, array fields, blade form input components and more.

Overview

Laravel Livewire Forms

TALL-stack form generator

Laravel Livewire, Tailwind forms with auto-generated views.

Latest Stable Version Total Downloads Latest Unstable Version License

Features

  • This is not an admin panel generator, it is a package that auto-generates Laravel Livewire forms without you having to create any blade views.
  • Laravel Nova like syntax to auto generate TALL-stack forms
  • Auto generate forms, with fields for ALL Eloquent Models, in a project - using a single artisan command.
  • Auto-generated views
  • Laravel Shift Blueprint plugin

Sponsor Heroes

๐Ÿ’— Please Sponsor ๐Ÿ”— It takes a lot of time to create and maintain this package. I am forever grateful to my sponsors.

Credits

Want to give tribute to those who made TALL-stack come true. (Alphabetically ordered ;)

๐Ÿ™‹ Help wanted

  • Pull Requests I appreciate any input that improves the functionality and usability of this package. Please contribute!

๐Ÿ’ฌ Let's connect

Discuss with other tall-form users on the official Livewire Discord channel. You'll find me in the "partners/tall-forms" channel.

Documentation See the wiki

Comments
  • Nested KeyVal fields

    Nested KeyVal fields

    @tanthammar you can test the nested KeyValfields with the following:

    Create a custom field:

    <?php
    
    namespace App\View;
    
    use Tanthammar\TallForms\KeyVal;
    
    class CustomKeyVal extends KeyVal
    {
        public $allowed_in_array = true;
    }
    
    

    and then used it:

    [
        KeyVal::make('Nested')->fields([
            \App\View\CustomKeyVal::make('Names')->fields([
                Input::make('Deutsch', 'de')->rules('required'),
                Input::make('English', 'en')->rules('required'),
            ]),
        ]),
    ]
    
    opened by danielbehrendt 35
  • Undefined variable: beforeFormView when adding wrapper layout

    Undefined variable: beforeFormView when adding wrapper layout

    Describe the bug I was following your documentation wiki for installing tall-forms and on the wrapper-layout step, I came into a problem that I am unable to solve. I am farely new to laravel so if there is something I skipped please be kind enough to help. Screenshots image

    Environment:

    • Tall-forms version: ^5.0
    • Livewire version: ^2.0
    • Laravel version: ^8.0
    • AlpineJS version (only needed if problem is Alpine related):
    • $wrapWithLayout true/false: Not Sure where to set this.
      • if true, Are you using your own wrapper component or the default one?: the default one
    • Optional model binding? no
    • Have you published the view files?: no
    • Have you published, and edited the config file?: yes published but not edited.
    • Is it a Create or Update form?: not applicable

    Fields Definition Please paste the code for your fields that is related to this issue.

    question 
    opened by michaelgatuma 15
  • Problem with URL in mount_form method

    Problem with URL in mount_form method

    There seems to be a problem with the mount_form method.

    $this->previous = \URL::previous(); is causing an CorruptComponentPayloadException:

    Livewire encountered corrupt data when trying to hydrate the [xyz] component. Ensure that the [name, id, data] of the Livewire component wasn't tampered with between requests.

    If I comment out line 38 in FormComponent.php everything works fine. I use the latest versions of laravel, livewire and tall-forms.

    bug fixed 
    opened by danielbehrendt 13
  • Use translated labels for displaying form errors

    Use translated labels for displaying form errors

    Hi, and thanks for a fantastic package!

    I'm translating all the labels in the form, so the fields are instantiated using both a label and a key. The labels are displayed using the translation.

    The problem is that the form validation messages uses the key, not the translation, to display form errors.

    Is there a way to use the translated labels in the error messages without using the errorMsg() function?

    enhancement Implemented 
    opened by lalov 12
  • Quill Editor & Choice (Select2 style) Field

    Quill Editor & Choice (Select2 style) Field

    1. Famous quill editor field.
    use Tanthammar\TallForms\QuillEditor;
    
    QuillEditor::make('global.post.content', 'content')
                    ->rules('required|string')
                    ->allowMedia() //allow Media (image,video,url, fx) in toolbar - default is false
                    ->theme('bubble') // default is 'snow'
                    ->quillAdvanced() // add all the advanced quill options to the toolbar - default is false
                    ->default('compose an awesome post...');
    
    1. Choice (Select2 style field)
    use Tanthammar\TallForms\Choice;
    Choice::make('Choice')
            ->options($options)
            ->placeholder('Please select an option')
            ->rules(['required', Rule::in(array_values($options))]);
    
    opened by arifpavel 11
  • Array field not working

    Array field not working

    I've used the example in the wiki, but the arrays do not show up. You see only Owner, but other than that there are no other fields. Am I missing something? I believe I've done everything as described.

    Field::make('Owners')->array([
            ArrayField::make('Full Name')->input()->placeholder('Full Name')->rules('required'),
            ArrayField::make('Phone Number')->input('tel')->placeholder('Phone Number'),
        ]),
    
    no-bug 
    opened by gavinhewitt 11
  • $this->model is NULL when you pass a model from Blade directive

    $this->model is NULL when you pass a model from Blade directive

    Describe the bug You can't reference the model within the component because it is null.

    The reason I'm trying to pass in the model in the directive is that the model instance is also not being picked up from the route. Consider this url:

    domain.test/admin/term/2569/edit
    
    // Route is declared as
    Route::get('/term/{id}/edit', 'TermEdit')
        ->name(term.edit');
    

    I'm expecting the fields on the edit form to have data, but they don't. When I dump $term in the component it's empty. I then tried to pass in the model, but that also does not work (tried dumping $this->model).

    Environment:

    • Tall-forms version: latest
    • Livewire version: latest
    • AlpineJS version (only needed if problem is Alpine related): latest
    • SpaMode true/false: false
      • if true, Are you using your own wrapper component or the default one?:
      • if true, Are you using a Route::livewire for model binding?
    • Have you published the view files?: Yes
    • Have you published, and edited the config file?: Yes
    • Is it a Create or Update form?: Update
    • Have you installed and configured the laravel-blade-icons package?: Yes

    Fields Definition Field::make('Title', 'title')->input()->rules('required'),

    documentation 
    opened by gavinhewitt 10
  • Support php8

    Support php8

    PHP8 has been released and the community is upgrading. I did not look into your test suite and source code, but at least we need composer updated.

    composer.json

    "require": {
       "php": "^8.0|^7.4",
    
    enhancement 
    opened by viezel 8
  • ErrorException Undefined variable:

    ErrorException Undefined variable:

    Hello. I am new to laravel. I want to use your package for my project. But something does not work out, I have already read the entire wiki. Created a form php artisan make:tall-form createOrder --model=Orders --path=Forms --action=create

    /app/Http/Livewire/Forms/createOrder.php

    namespace App\Http\Livewire\Forms;
    
    use App\Models\Orders;
    use Livewire\Component;
    use Tanthammar\TallForms\Input;
    use Tanthammar\TallForms\TallForm;
    
    class createOrder extends Component {
    
    	use TallForm;
    
    	public function mount( ? Orders $orders) {
    		//Gate::authorize()
    		$this->fill([
    			'formTitle' => trans('global.create') . ' ' . trans('crud.orders.title_singular'),
    			'wrapWithView' => false, //see https://github.com/tanthammar/tall-forms/wiki/installation/Wrapper-Layout
    			'showGoBack' => false,
    		]);
    
    		$this->mount_form($orders); // $orders from hereon, called $this->model
    	}
    
    	// Mandatory method
    	public function onCreateModel($validated_data) {
    		// Set the $model property in order to conditionally display fields when the model instance exists, on saveAndStayResponse()
    		$this->model = Orders::create($validated_data);
    	}
    
    	// OPTIONAL method used for the "Save and stay" button, this method already exists in the TallForm trait
    	public function onUpdateModel($validated_data) {
    		$this->model->update($validated_data);
    	}
    
    	public function fields() {
    		return [
    			Input::make('Name')->rules('required'),
    		];
    	}
    }
    

    resources/views/livewire/orders.blade.php

    <livewire:forms.create-order :orders="$orders" />

    I get an error

    ErrorException
    Undefined variable: orders (View: /var/www/autokit/resources/views/livewire/orders.blade.php)
    

    Laravel 8 Livewire 2.3.1

    no-bug question 
    opened by Zheka2011 8
  • issue with saveFoo

    issue with saveFoo

    I have a couple of forms which are using the saveFoo method, one being a file uploader, and one uses checkboxes. Followed your examples (very handy i must add) and it all appeared to work fine, except it wouldnt save to the db table.

    On the file upload, i tried with updatedFoo method, and the file would be uploaded and stored, but the value wouldnt be saved to the db table.

    On the checkboxes, despite multiple boxes being checked, a dump of the $validated_value returns null.

    I will freely admit, i've just started paying with this, and this could be a 'user error' and not necessarily a bug, but after seeing it on two separate things, i wondered if it may be related.

    Environment:

    • Tall-forms version: 4.1.2
    • Livewire version: 1.2
    • Laravel: 8.6
    • Is it a Create or Update form?: Update
    • Have you installed and configured the laravel-blade-icons package?: Yes

    Fields Definition Component example (checkboxes) namespace App\Http\Livewire\Forms;

    use Livewire\Component; use Tanthammar\TallForms\Input; use Tanthammar\TallForms\TallForm; use Tanthammar\TallForms\Checkboxes;

    use App\Models\Source; use App\Models\Gateway; use App\Models\Channel;

    class GatewayChannelsUpdateForm extends Component { use TallForm;

    public $channels;
    
    public function mount(Gateway $gateway)
    {
        //Gate::authorize()
        $this->fill([
    
            'wrapWithView' => false, //see https://github.com/tanthammar/tall-forms/wiki/installation/Wrapper-Layout
            'showGoBack' => false,
            'showReset' => false,
            'showDelete' => false,
            'inline' => false,
            'showTitle' => false,
        ]);
    
        $this->mount_form($gateway); // $gateway from hereon, called $this->model
    }
    
    // Optional method, this already exists in the TallForm trait
    public function onUpdateModel($validated_data)
    {
        $this->model = $this->model->update($validated_data);
    }
    
    public function beforeFormProperties()
    {
        // get existing relations, read the checkboxes docs about integer values
        $this->model->channel_ids = array_map('strval', optional($this->model->channels)->pluck('id')->all());
    
        // set the checkboxes options
        $this->channels = Channel::orderBy('name')->get()->pluck('id', 'name')->all();
    }
    
    public function fields()
    {
    
        return [
            Checkboxes::make('Select gateway channels', 'channel_ids')
                ->options($this->channels)
                ->relation()
                ->rules('nullable|array|exists:channels,id')
                ->wire('wire:model.defer')
        ];
    
    }
    
    public function saveChannelIds($validated_value)
    {
        //get the options that the user selected via the field name
        $selected_channels = $validated_value;
    
        //if the user unselected all available options it means we have to detach any existing relations
        dd($selected_channels);
        if (blank($selected_channels)) {
            $this->model->channels()->detach(); //detach all existing relations
        } else {
            //in this example we scoped the events to the users current team, so we check which events the user is allowed to attach
            //this is also a good example on how to validate the submitted data
            $allowed_to_sync = filled($selected_channels) ? array_intersect($selected_channels, array_values($this->channels)) : [];
            if (filled($allowed_to_sync)) $this->model->channels()->sync($selected_channels);
        }
    }
    

    }

    bug fixed 
    opened by goldienz 8
  • livewireValue is not defined

    livewireValue is not defined

    Returns an error when changing a select several times.

    module.esm.js?027e:1656 Uncaught ReferenceError: livewireValue is not defined
        at eval (eval at safeAsyncFunction (module.esm.js:1:1), <anonymous>:3:32)
        at eval (module.esm.js?027e:1718:1)
        at tryCatch (module.esm.js?027e:1645:1)
        at HTMLInputElement.el._x_forceModelUpdate (module.esm.js?027e:2974:1)
        at eval (module.esm.js?027e:2985:1)
        at reactiveEffect (module.esm.js?027e:484:1)
        at Object.effect3 [as effect] (module.esm.js?027e:459:1)
        at effect (module.esm.js?027e:1299:1)
        at eval (module.esm.js?027e:2392:1)
        at wrappedEffect (module.esm.js?027e:1315:1)
    
    <?php
    
    namespace App\Http\Livewire\Forms\Persons;
    
    use App\Models\Person;
    use App\Models\Staff;
    use Illuminate\Support\Collection;
    use phpDocumentor\Reflection\Types\Boolean;
    use Tanthammar\TallForms\Input;
    use Tanthammar\TallForms\Select;
    use Tanthammar\TallForms\TallFormComponent;
    use Tanthammar\TallFormsSponsors\DatePicker;
    use Tanthammar\TallFormsSponsors\Email;
    use Tanthammar\TallFormsSponsors\Tel;
    
    class CreateOrUpdatePerson extends TallFormComponent
    {
        public Collection $breads;
        public string  $formTitle = '';
        public array $staffs = [];
        public bool $show_birthday_and_certificate = true;
        public function mount(?Person $person)
        {
            $this->formTitle = $person->exists ?
                __('Edit :item ', ['item'=> $person->name])
                : __('Add :model ', ['model'=> __('Person')]);
    
            $this->breads = new Collection([
                ['text'=> __('Persons'), 'url'=> 'persons'],
                ['text'=> __($this->formTitle)],
    
            ]);
    
            //Gate::authorize()
            $this->mount_form($person); // $person from hereon, called $this->model
        }
    
        protected function formAttr(): array
        {
            return [
                'wrapWithView' => true,
                'showDelete' => false,
            ];
        }
    
        // OPTIONAL methods, they already exist
        protected function onCreateModel($validated_data)
        {
            $this->model = Person::create($validated_data);
        }
    
        protected function onUpdateModel($validated_data)
        {
            $this->model->update($validated_data);
        }
    
        protected function onDeleteModel()
        {
            $this->defaultDelete();
        }
    
        protected function beforeFormProperties()
        {
            // set the checkboxes options
            $this->staffs = Staff::orderBy('id','desc')->pluck('id', 'name')->all();
        }
        protected function fields(): array
        {
            return [
                Select::make(__('Staff'), 'staff_id')
                    ->options($this->staffs)
                    ->rules('required')
                    ->colspan(6),
    
                Input::make(__('Name'),'name')
                    ->rules('required')
                    ->autocomplete('new-text')
                    ->colspan(6),
    
                Email::make(__('Email'),'email')
                    ->autocomplete('new-email')
                    ->colspan(6),
    
                Tel::make(__('Phone'),'phone')
                    ->autocomplete('new-tel')
                    ->colspan(6),
    
               $this->show_birthday_and_certificate ? DatePicker::make(__('Birthday'),'birthday')
                    ->locale('en')
                    ->placeholder('Select a date...')
                    ->includeExternalScripts() //only included once, if multiple DatePicker fields
                    ->colspan(6) : null,
    
               $this->show_birthday_and_certificate ? Input::make(__('Certificate'),'certificate')
                    ->rules('nullable')
                    ->autocomplete("off")
                    ->colspan(6) : null,
    
                Input::make(__('Address'),'address')
                    ->rules('nullable')
                    ->autocomplete('new-address'),
            ];
        }
    
        public function updatedStaffId($value)
        {
            if(filled($value) && ($value === "2" || $value === "5")){
                $this->show_birthday_and_certificate = false;
            }else{
                $this->show_birthday_and_certificate = true;
            }
        }
    
    }
    
    bug fixed 
    opened by swarakaka 7
  • Masked input with imask.js

    Masked input with imask.js

    hi,

    learned that commiting fixes to master is a bad idea, this is a extra branch replacing #111 pull request


    first shot at the integration of imask.js ( https://imask.js.org/ ) into the input field, works for me

    Input::make('datemasked')->maskOptions(
                    "{mask: Date, lazy: false}"
                )
    
    Input::make('Masktest', 'masktest')->rules('required')->maskOptions(
                        "{mask: '(00)00-00-00',  lazy: false,  placeholderChar: 'x' }"
                    ),
    

    possible enhancements:

    • Get either the masked or unmasked value back from the imask object and not the input value
    • make including js configurabe
    • add docs ;)
    opened by simonbuehler 0
  • support rules as array for multiple file uploads

    support rules as array for multiple file uploads

    allows rules for multiple files like ->rules(['files' => 'between:1,3', 'files.*' => 'required|max:1024']) so not only the individual file properties are validated but also e.g. the min/max number of uploaded files

    opened by simonbuehler 4
  • add imask.js masking options to input field

    add imask.js masking options to input field

    hi,

    first shot at the integration of imask.js ( https://imask.js.org/ ) into the input field, works for me

    Input::make('datemasked')->maskOptions(
                    "{mask: Date, lazy: false}"
                )
    
    Input::make('Masktest', 'masktest')->rules('required')->maskOptions(
                        "{mask: '(00)00-00-00',  lazy: false,  placeholderChar: 'x' }"
                    ),
    

    possible enhancements:

    • Get either the masked or unmasked value back from the imask object and not the input value
    • make including js configurabe
    • add docs ;)
    opened by simonbuehler 6
  • FileUpload with Repeater

    FileUpload with Repeater

    Describe the bug

    While using FileUpload inside of Repeater all image changes together, and sometimes the file field disappear please check the screenshots attached

    Screenshots fileupload1

    Environment:

    • Tall-forms version: 8.1
    • Livewire version:2.5
    • Laravel version: 8.6
    • AlpineJS version (only needed if problem is Alpine related):3.7
    • $wrapWithLayout true/false:false
      • if true, Are you using your own wrapper component or the default one?:
    • Optional model binding? true
    • Have you published the view files?: only resources/views/vendor/tall-forms/includes/file-loop.blade.php
    • Have you published, and edited the config file?:no
    • Is it a Create or Update form?:create

    Fields Definition Please paste the code for your fields that is related to this issue.

        use WithFileUploads, UploadsFiles;
    
        public $main_image;
        public $extra_image;
    
        public function mount(?Item $item)
        {
            $this->mount_form($item);
        }
    
        protected function fields(): array
        {
            return [
                Repeater::make('variation')->fields([
    
                    FileUpload::make("Main Image", 'main_image')
                        ->help('Max (720px * 720px), png, jpeg, gif or tiff')
                        ->rules('nullable|mimes:png,jpg,jpeg,gif,tiff|dimensions:width=720,height=720')
                        ->accept("image/*")->inline(),
    
                    FileUpload::make("Extra Images", 'extra_image')
                        ->multiple()
                        ->help('Max (720px * 720px), png, jpeg, gif or tiff')
                        ->rules('nullable|mimes:png,jpg,jpeg,gif,tiff|dimensions:width=720,height=720')
                        ->accept("image/*")->inline(),
    
                    Input::make('Name'),
    
                    Input::make('Value')->type('color'),
    
                ])->confirmDelete()
                    ->wrapperClass('grid grid-cols-2  divide-y mb-2 rounded border')
                    ->labelEachRow()->sortable()
                    ->help('Click plus to add variations')
                ,
            ];
        }
    
    help wanted 
    opened by tamaraR96 2
  • Reset function done, full screen feature added on Quill

    Reset function done, full screen feature added on Quill

    Hi, Reset is now working with Quill & Choice field.

    I've added a full-screen option for Quill too. Fullscreen can be enabled by piping up ->allowFullScreen()

    Thanks

    opened by arifpavel 3
Releases(8.2.9)
A TALL-based Laravel Livewire component to replace the (multiple) select HTML input form with beautiful cards.

TALL multiselect cards A TALL-based Laravel Livewire component to replace the (multiple) select HTML input form with beautiful cards. Table of content

Frederic Habich 19 Dec 14, 2022
Livewire Notifier is a simple notifications system with zero dependencies above TALL-stack

Livewire Notifier is a simple notifications system with zero dependencies above TALL-stack (Tailwind CSS, Alpine.JS, Laravel and Livewire).

CodeSPB 18 Jul 27, 2022
Blade UI Kit is a set of renderless components to utilise in your Laravel Blade views

Blade UI Kit is a set of renderless components to utilise in your Laravel Blade views. In all essence, it's a collection of useful utilities, connecting the dots between different parts of the TALL stack. It was made for Blade, Laravel's powerful templating engine.

Blade UI Kit 1.2k Jan 5, 2023
Laravel Livewire form component with declarative Bootstrap 5 fields and buttons.

Laravel Livewire Forms Laravel Livewire form component with declarative Bootstrap 5 fields and buttons. Requirements Bootstrap 5 Installation composer

null 49 Oct 29, 2022
This package allows you to render livewire components like a blade component, giving it attributes, slots etc

X-livewire This package allows you to render livewire components like a blade component, giving it attributes, slots etc. Assuming you wanted to creat

null 7 Nov 15, 2022
Laravel-comments-livewire - Livewire components for the laravel-comments package

Associate comments and reactions with Eloquent models This package contains Livewire components to be used with the spatie/laravel-comments package. S

Spatie 15 Jan 18, 2022
A collection of pre-made simple Laravel Blade form components.

Laravel Form Components Library A collection of pre-made simple Laravel Blade form components. Installation & setup You can install the package via co

null 3 Oct 5, 2022
Gallium is a TALL stack starter kit offering a robust set of options enabling you to get up and running in a snap.

Very short description of the package This is where your description should go. Try and limit it to a paragraph or two, and maybe throw in a mention o

null 1 Nov 20, 2021
Laravel Package to generate CRUD Files using TALL Stack

tall-crud-generator Laravel Package to generate CRUD Files using TALL Stack Requirements Make sure that Livewire is installed properly on your project

AscSoftwares 75 Jan 2, 2023
Automated Laravel TALL-stack installation with superpowers.

Easy command to install the TALL-stack & jumpstart development ?? This package provides a simple artisan command for Laravel that can fully scaffold y

Ralph J. Smit 38 Dec 3, 2022
A TALL (Tailwind CSS, Alpine.js, Laravel and Livewire) Preset for Laravel

Laravel TALL Preset A front-end preset for Laravel to scaffold an application using the TALL stack, jumpstarting your application's development. If yo

Laravel Frontend Presets 1.8k Jan 7, 2023
A collection of tools for rapidly building beautiful TALL stack interfaces, designed for humans.

Filament is a collection of tools for rapidly building beautiful TALL stack interfaces, designed for humans. Packages Admin Panel โ€ข Documentation โ€ข De

Filament 5.4k Jan 4, 2023
Example of using TALL stack to select country phone code.

Select country phone code using TALL stack About Example of using TALL stack to select country phone code. Each item represents a country. Each item h

Fernando Chagas 3 Jul 27, 2022
Source for "Getting Started with TALL stack" post

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Kim Hallberg 2 Sep 16, 2022
Base library for repeated layout fields, content builders and other collection components

laravel-flexible-content This package's only purpose is to build custom repeated layout components, such as Laravel Nova's Flexible Content field or y

Whitecube 5 May 31, 2022
Useful blade components and functionality for most Laravel projects.

laravel-base Note: Package is still in early stages of development, so functionality is subject to change. LaravelBase is a package I've created to pr

Randall Wilk 3 Jan 16, 2022
Keyword Generator Tool helps you discover keyword opportunities related to your query input.

This plugin simply helps you discover keyword opportunities related to your query input. Installation Download the zip file of the repository or clone

WP Refers 1 May 3, 2022
Realtime Notification Module With Laravel & Pusher

About Noftiy Module This module to organize the notification process in real time without need to reload page, using PHP language with Laravel framewo

Mohamed Magdy 1 Jan 9, 2022
Custom Blade components to add sortable/drag-and-drop HTML elements in your apps.

Laravel Blade Sortable Demo Repo Installation You can install the package via composer: composer require asantibanez/laravel-blade-sortable After the

Andrรฉs Santibรกรฑez 370 Dec 23, 2022