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 (1056 lessons, total 44 h 09 min)
  • 78 long-form tutorials (one new every week)
  • access to project repositories
  • access to private Discord

Recent Premium Tutorials