Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Form Components Laravel Package

rawilk/laravel-form-components

A set of reusable Blade form components for Laravel that make building consistent forms quick and clean. Includes inputs, selects, checkboxes, radios, buttons, errors, and styling-friendly markup, with flexible config and easy customization.

View on GitHub
Deep Wiki
Context7

title: Form sort: 1

Introduction

The form component helps you with removing the bulk work when setting up forms in Laravel. By default, it sets the HTTP method and CSRF directives and allows for easier to use syntax than the default HTML form tag.

Basic Usage

The most basic usage of the form component exists in encapsulating some form elements:

<x-form action="https://example.com"> Form fields... </x-form>

This will output the following HTML:

<form method="POST" action="https://example.com" spellcheck="false">
    <input type="hidden" name="_token" value="..." />
    <input type="hidden" name="_method" value="POST" />

    Form fields...
</form>

By default, a POST HTTP method will be set. Of course, you can customize this. You can also enable spellcheck (remove the spellcheck="false" attribute that is set by default) as well:

<x-form method="PUT" action="https://example.com" spellcheck>
    Form fields...
</x-form>

This will output the following HTML:

<form method="POST" action="https://example.com">
    <input type="hidden" name="_token" value="..." />
    <input type="hidden" name="_method" value="PUT" />

    Form fields...
</form>

As you can see, a _method input was added since HTML tags only support POST and GET requests. Laravel uses the _method key to determine which exact route action is called.

File Uploads

To enable file uploads in a form you can make use of the has-files attribute:

<x-form action="https://example.com" has-files> Form fields... </x-form>

This will output the following HTML:

<form
    method="POST"
    action="https://example.com"
    enctype="multipart/form-data"
    spellcheck="false"
>
    <input type="hidden" name="_token" value="..." />

    Form fields...
</form>

Now file input fields will be able to be submitted with the form.

API Reference

props

prop description
action Server endpoint to submit the form to
method Request method to use for the submission. Defaults to POST
hasFiles A boolean indicating the form should submit files. Defaults to false
spellcheck A boolean indicating the form should allow the browser to spellcheck the inputs inside of it. Defaults to false (spellcheck disabled on form)
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
jhaskell13/laraflow
sebastienheyd/boilerplate-media-manager
ccast/tagixo-primix
pretendtrue/laravel-builder
sawmainek/laravel-scout-tntsearch-driver
tomshaw/laravel-calendar-table
dibakar/laravel-ownership
steadrun/laravel-monitor
labyrinthe/connect-laravel
elmogy/layan
drewdan/sentinel-client
dskripchenko/laravel-llm
fatryst/nuonuo
stevenay/myanfont
gmostafa/php-graphql-client
xeviant/paystack
snowsoft/faker
meditationsteps/blogetc
animalyoung/laravel-influxdb
onix-solutions/sms-telera