Skip to content
This repository was archived by the owner on Oct 20, 2025. It is now read-only.

Conversation

@J87NL
Copy link
Contributor

@J87NL J87NL commented Apr 2, 2023

Added a wrapper around submit buttons in order to be able to apply separate styling to the button and its wrapper, for example:

<?php

namespace App\Forms;

use ProtoneMedia\Splade\AbstractForm;
use ProtoneMedia\Splade\FormBuilder\Submit;
use ProtoneMedia\Splade\FormBuilder\Text;
use ProtoneMedia\Splade\FormBuilder\Textarea;
use ProtoneMedia\Splade\SpladeForm;

class ProfileForm extends AbstractForm
{
    public function configure(SpladeForm $form)
    {
        $form->class('grid grid-cols-2 gap-4');
    }

    public function fields(): array
    {
        return [
            Text::make('first_name')->label(__('First name')),

            Text::make('last_name')->label(__('Last name')),

            Textarea::make('bio')->label('Biography')->class('col-span-2'),

            Submit::make()->label(__('Save'))->parentClass('col-span-2 text-center'),
        ];
    }
}

The example above will now look like:

afbeelding

@pascalbaljet pascalbaljet merged commit 0bc146b into protonemedia:main Jun 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants