Download the PHP package bastinald/laravel-livewire-forms without Composer
On this page you can find all versions of the php package bastinald/laravel-livewire-forms. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download bastinald/laravel-livewire-forms
More information about bastinald/laravel-livewire-forms
Files in bastinald/laravel-livewire-forms
Package laravel-livewire-forms
Short Description Laravel Livewire form component with declarative Bootstrap 5 fields and buttons.
License MIT
Homepage https://github.com/bastinald/laravel-livewire-forms
Informations about the package laravel-livewire-forms
Laravel Livewire Forms
Laravel Livewire form component with declarative Bootstrap 5 fields and buttons.
Requirements
- Bootstrap 5
Installation
Usage
Make a new form:
Declare fields:
Declare buttons:
Declare rules:
Declare an action (notice the use of ->click('createUser')
in the button example above:
Full Page Forms
Create a full page form by specifying a title
, layout
and route
to use:
The route
method is made available by using my laravel-livewire-routes package.
Setting Initial Data
You can set the initial form data / defaults via the data
array property in your component mount
method:
Accessing Data
Use the data
method in the component to access current form data (you can use dot notation for array values):
Data Binding
Most fields allow you to change the way livewire binds data via helper methods that are chained to fields e.g.:
Sizing
Many fields also allow you to specify a size for the input e.g.:
Disabling
Some fields allow you to disable or set them to readonly, and even plaintext for inputs:
Helper Text
Specify helper text for a field by using the help
method:
Available Fields
Alert ($message, $style = 'success')
An alert box.
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)
An array of fields.
Available methods: fields
, help
, disabled
Button ($label = 'Submit', $style = 'primary')
A button used for actions and links.
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)
A checkbox field.
Use the switch
method to style the checkbox as a switch.
Available methods: switch
, help
, instant
, defer
, lazy
, debounce
, disabled
Checkboxes ($name, $label = null)
An array of checkbox fields.
Available methods: options
, switch
, help
, instant
, defer
, lazy
, debounce
, disabled
Color ($name, $label = null)
A color picker field.
Available methods: small
, large
, help
, instant
, defer
, lazy
, debounce
, disabled
, readonly
Conditional
A statement used to conditionally show fields.
Available methods: if
, elseif
, else
DynamicComponent ($name, $attrs = [])
A field used to display dynamic third-party components.
This would translate to <x-honey/>
and <x-honey recaptcha="recaptcha"/>
in your form.
File ($name, $label = null)
A file upload field.
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)
An input field.
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)
A radio field.
Available methods: options
, switch
, help
, instant
, defer
, lazy
, debounce
, disabled
Select ($name, $label = null)
A select dropdown field.
Available methods: options
, small
, large
, help
, instant
, defer
, lazy
, debounce
, disabled
, placeholder
Textarea ($name, $label = null)
A textarea field.
Available methods: small
, large
, help
, instant
, defer
, lazy
, debounce
, disabled
, readonly
, placeholder
, rows
View ($name, $data = [])
Used to render a custom Blade view inside the form.