Support the ongoing development of Laravel.io →
Input Views Forms

What I need is: (note that there is NOTHING between the label opening and closing tag)

<label for="username" data-icon="u" ></label>

What I try in Laravel for this is:

{{Form::label('email', null, array('data-icon' => 'u'))}}

and

{{Form::label('email', '', array('data-icon' => 'u'))}}

But Laravel still automatically adds the default text, when I view the html I see:

<label for="email" data-icon="u">Email</label>

This is pretty frustrating, anybody know an easy fix?

Last updated 3 years ago.
0

https://github.com/laravel/framework/blob/4.2/src/Illuminate/Html/FormBuilder.php

The reason of this behaviour is in formatLabel method. You could use a whitespace as label value:

{{Form::label('email', " ", array('data-icon' => 'u'))}}
Last updated 3 years ago.
0

Sign in to participate in this thread!

PHPverse

Your banner here too?

Maveee maveee Joined 26 Oct 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.