TALL-forms
  • TALL-forms
  • Installation
    • Quickstart: Artisan cmd
    • Manual installation
      • Package
      • Translations
      • Css & Theme
      • Javascript
      • Tailwind
      • Laravel Mix
      • Wrapper view
      • Laravel Jetstream/Breeze
  • Upgrade v7 to v8
    • Configuration changes
    • Component & Field changes
    • Blade view changes
    • Notification changes
    • Styling changes
  • Concept
    • Configuration
    • Validation
    • Styling
    • Icons
    • Javascript
    • Layout vs Wrapper
    • Model binding
    • Manually saving data
    • Extend Blade Components
  • Create Forms
    • Form Data
    • Form Types
      • Standard form
      • As modal
      • Without buttons
      • Fields only
      • Headless
    • Form attributes
    • Form buttons
    • Form slots
    • Form methods
    • Lifecycle hooks
    • Render a form
    • Mass generate
  • Fields
    • Declaration
    • Labels
    • Field Slots
    • Field methods
    • Custom field attributes
    • Conditional field
    • Custom view
    • Custom field
    • Custom Livewire component
    • Relations
    • Fields
      • Checkbox
      • Checkboxes
      • FileUpload
      • Honeypot
      • ImageCropper
      • Input
      • Password
      • InputArray
      • KeyVal (array)
      • Radio
      • Range
      • Repeater (array)
      • Search
      • Select & Multiselect
      • Tags
      • TagsSearch
      • Textarea
      • Trix
      • SpatieTags
    • Sponsor Fields
      • More Inputs
      • CKEditor
      • DatePicker
      • Heading
      • Markdown
      • Panels
      • SearchList
      • SelectOptGroup
      • Tabs
      • Trix, file-uploads
  • Blade components
    • Notifications
    • Label wrapper
    • Button
    • Modal blade component
    • Modal form blade component
  • Examples
    • Input examples
    • Array fields example
Powered by GitBook
On this page
  • Tip, custom scripts
  • Slot precedence
  • Styling

Was this helpful?

  1. Create Forms

Form slots

PreviousForm buttonsNextForm methods

Last updated 3 years ago

Was this helpful?

protected function formAttr(): array
{
    return [        
        'beforeFormView' => 'path/your-blade-view-name', //@include a blade view before the form, above the $headView/$formTitle, $formSubtitle slots
        'afterFormView' => 'path/your-blade-view-name', //@include a blade view after the form, below the buttons.
        
        'headView' => 'path/your-blade-view-name', //@include a blade view in the $headView form slot, above the form. Disregards $wrapWithView
        
        'formTitle' => 'string', //displayed above the form if !$headView or !$wrapWithView
        'formSubtitle' => 'string', //displayed above the form, below the $formTitle, if !$headView or !$wrapWithView
        
        'footerView' => 'path/your-blade-view-name', //@include a blade view in the $footerView form slot, above the buttons
        'formFooterTitle' => 'string', //displayed above the buttons if !$footerView
        'formFooterSubtitle' => '', //displayed above the buttons, below the $formFooterTitle, if !$footerView
        
        //See "Layouts vs Wrapper" page
        'wrapWithView' => true,
        'wrapViewPath' => config('tall-forms.wrap-view-path'),
        'layout' => 'layouts.app',
    ]
}

Tip, custom scripts

$afterFormView or $beforeFormView are nice slots to include scripts in combination with some input attributes.

protected function formAttr(): array
{
    return [
        'afterFormView' => 'scripts/foo';
    ];
}

// in fields()
Input::make('Name')
    ->wire('wire:model.defer')
    ->rootAttr([
       'x-data' => "foo()",
       'class' => 'border rounded',
    ])
    ->inputAttr([
        'x-ref' => 'name',
    ])
    ->required(),

resources/views/scripts/foo.blade.php

@push('scripts')
<script>
    function foo() {
        //access this.$refs.name        
    }
</script>
@endpush

Slot precedence

@if(empty($headView) && !$wrapWithView && ($formTitle || $formSubtitle))
//show formTitle and formSubtitle
@endif
@if(filled($headView))
    @include($headView)
@endif
@if(empty($footerView) && ($formFooterTitle || $formFooterSubtitle))
//show formFooterTitle and formFooterSubtitle
@endif
@if(filled($footerView))
    @include($footerView)
@end

Styling

  • form-head

  • form-title

  • form-sub-title

  • form-footer

  • form-footer-title

  • form-footer-sub-title

Form attributes related to form slots. Defaults are set in the file

Some styles are set in the file

config
config