Filament: Render HTML in a Label

Render HTML (eg. link) in a field label().

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

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

Tip given by sandeshkumard

Like our articles?

Become a Premium Member for $129/year or $29/month
What else you will get:
  • 73 courses
  • 93 long-form tutorials
  • access to project repositories
  • access to private Discord

Recent New Courses