As modal
Requires an Eloquent Model
Extend the TallFormInModal component
Steps
Create the form
php artisan make:tall-form UserModalForm --action=modal --model=Usernamespace App\Http\Livewire\Forms;
use App\Models\User;
use Tanthammar\TallForms\Input;
use Tanthammar\TallForms\TallFormInModal;
class UserModalForm extends TallFormInModal
{
/*
* button color presets:
* white, indigo, blue, green, yellow, red, gray, orange, teal, info, success, danger, warning, primary, secondary
public string $closeBtnColor = 'white';
public string $submitBtnColor = 'primary';
* Methods to override
public function loadModal(int|string $modelKey): void
public function closeModal(): void
public function modalSubmit(): void
*/
public function mount()
{
$this->mount_form(new User);
}
protected function formAttr(): array
{
return [
'formTitle' => 'Edit user',
'formSubtitle' => 'Form Subtitle slot',
'modalMaxWidth' => 'xl', //default = 'lg', options: sm, md, lg, xl, 2xl
];
}
protected function fields(): array
{
return [
Input::make('Name')->rules('required'),
];
}
}Create a button and pass a $modelKey
Add the modal form component
Button colors
Override methods
Styling
Modal sizes
Last updated
Was this helpful?