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:
  • 59 courses (1057 lessons, total 42 h 44 min)
  • 79 long-form tutorials (one new every week)
  • access to project repositories
  • access to private Discord

Recent Premium Tutorials