Tricks

Add a link / html to field label()

Sep 7, 2022
Martin Mildner
Form builder

Return an HtmlString object in order to add HTML to a field label.

Example:

use Illuminate\Support\HtmlString;
 
Checkbox::make('accept')
->label(fn () => new HtmlString('I accept the <a href="" target="_blank">terms and conditions</a>'))
->required(),

No comments yet…