Form

The FormComponent lets you embed a Tally form on your page. It automatically converts a Tally URL into a form.
The embedUrl()
method outputs the code that converts your shared URL into a form.
{!! $page->form('newsletter')->embed() !!}
Note: If no form is saved, nothing will be rendered.
Customize the appearance of your form by using the following decoration methods:
Displays the form title.
{!! $page->form('newsletter')->withTitle()->embed() !!}
Applies extra padding to the form content. Without this option, the content will be aligned to the left.
{!! $page->form('newsletter')->withPadding()->embed() !!}
Adds a background to the form embed. If omitted, the form will render with a transparent background.
{!! $page->form('newsletter')->withBackground()->embed() !!}
Use the required()
method to mark the form field as mandatory.
{!! $page->form('newsletter')->required()->embed() !!}
The label()
method sets a title for the admin panel, making it easier to identify the form field in your administrative interface. This does not affect the frontend.
{!! $page->form('newsletter')->label('Newsletter Signup')->embed() !!}
After defining your form component with ->form('newsletter')
, use the getTitle()
method to retrieve the form’s title:
<h3 class="text-2xl font-bold">{{ $page->newsletter->getTitle() }}</h3>
You can verify if the user has saved valid data by using the get() method to retrieve the stored data and check its validity. This method returns the saved value as an array, or null
if it not set. This is useful for conditionally rendering the form and its surroundings.
@if($page->newsletter->get())
<div>{!! $page->tally('newsletter')->embed() !!}</div>
@endif