# Form slots

![](https://github.com/tanthammar/tall-forms/wiki/head-view.png)

![](https://github.com/tanthammar/tall-forms/wiki/footer-title.png)

Form attributes related to form slots. Defaults are set in the [config](/tall-forms/concept/configuration.md) file

```php
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.

```php
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`

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

### Slot precedence&#x20;

```php
@if(empty($headView) && !$wrapWithView && ($formTitle || $formSubtitle))
//show formTitle and formSubtitle
@endif
@if(filled($headView))
    @include($headView)
@endif
```

```php
@if(empty($footerView) && ($formFooterTitle || $formFooterSubtitle))
//show formFooterTitle and formFooterSubtitle
@endif
@if(filled($footerView))
    @include($footerView)
@end
```

### Styling

Some styles are set in the [config](/tall-forms/concept/configuration.md) file

* form-head
* form-title
* form-sub-title
* form-footer
* form-footer-title
* form-footer-sub-title


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://tina-hammar.gitbook.io/tall-forms/form/form-slots.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
