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:
  • 68 courses (1183 lessons, total 43 h 18 min)
  • 90 long-form tutorials (one new every week)
  • access to project repositories
  • access to private Discord

Recent New Courses