Skip to main content

Forms

Form Actions code

Copy the implementation or inspect every file that belongs to this component unit.

resources/views/components/ui/form-actions.blade.php

@props([
    'align' => 'end',
    'sticky' => false,
])

@php
    /*
    | Consistent form action row. Place at the bottom of form-section/card forms.
    |
    | Usage:
    |   <x-ui.form-actions>
    |       <x-ui.button.cancel />
    |       <x-ui.button.save />
    |   </x-ui.form-actions>
    */
    $alignClass = [
        'start' => 'justify-start',
        'center' => 'justify-center',
        'between' => 'justify-between',
        'end' => 'justify-end',
    ][$align] ?? 'justify-end';
@endphp

<div
    {{ $attributes->merge([
        'class' => trim("flex flex-col-reverse gap-2 border-t border-gray-200 bg-gray-50/70 px-6 py-4 dark:border-gray-800 dark:bg-gray-950/35 sm:flex-row sm:items-center {$alignClass} ".($sticky ? 'sticky bottom-0 z-10 backdrop-blur' : '')),
    ]) }}
>
    {{ $slot }}
</div>