Search code examples
htmlcsslaravelfont-awesomelaravel-form

font awesome icon with laravel 5 form


I have a form in laravel5 like this

{!! Form::text('name', '' , array('placeholder' => 'Name' , 'class' => 'form-control') ) !!}

I need to use a icon inside this textBox,I'm using FontAwesome 4.7.0,in the documentation it says the to put the FontAwesome class inside the <i> tag but I have no idea how to insert the <i> inside the laravel Form. I have tried this

<i class="fa fa-user-circle-o">
{!! Form::text('name', '' , array('placeholder' => 'Name' , 'class' => 'form-control') ) !!}</i>

How should I embed the tag?


Solution

  • Looking at the bootstrap 3 examples on this page http://fontawesome.io/examples/, I believe you need to do something like the following?

    <div class="input-group margin-bottom-sm">
        <span class="input-group-addon"><i class="fa fa-user-circle-o"></i></span>
        {!! Form::text('name', '' , array('placeholder' => 'Name' , 'class' => 'form-control') ) !!}
    </div>