Open In App

Bulma Input with Font Awesome icons

Bulma is a free, open-source CSS framework based on flexbox. It is component-rich, compatible, and well documented. It is highly responsive in nature. It uses classes to implement its design.

Bulma input with font awesome icons are used to set the icons in an input field. The font awesome icons are used either left or right or both sides. By default, the icon will display in the center.



Bulma input with font awesome icons classes:

We can add one of the two modifiers to the control class layout.



Syntax:

<p class="control has-icons-left">...</p>

After adding the modifiers on the control class layout, you need to add a modifier on the icon.

Syntax:

<input class="input" type="" placeholder="">
    <span class="icon is-left">
      <i class="fas fa-envelope"></i>
    </span>

Example:




<!DOCTYPE html>
<html>
  
<head>
    <title>Bulma Input with Font Awesome icons</title>
    <link rel='stylesheet'
          href=
    <link rel="stylesheet" 
          href=
</head>
  
<body class="has-text-centered">
    <h1 class="is-size-1 has-text-success">
        GeeksforGeeks
    </h1>
    <p class="is-size-3">
      Bulma Input with Font Awesome icons
    </p>
  
  
    <div class="container">
        <div class="field">
            <p class="control has-icons-right">
                <input class="input" type="text" 
                    placeholder="Enter Name">
                <span class="icon is-right">
                    <i class="fa fa-check"></i>
                </span>
            </p>
  
        </div>
  
        <div class="field">
            <p class="control has-icons-left has-icons-right">
                <input class="input" type="text" 
                       placeholder="Enter Address">
                <span class="icon is-small is-left">
                    <i class="fa fa-map-marker"></i>
                </span>
                <span class="icon is-small is-right">
                    <i class="fa fa-check"></i>
                </span>
            </p>
  
        </div>
  
        <div class="field">
            <p class="control has-icons-left has-icons-right">
                <input class="input" type="number" 
                       placeholder="Mob No.">
                <span class="icon is-small is-left">
                    <i class="fa fa-mobile"></i>
                </span>
                <span class="icon is-small is-right">
                    <i class="fa fa-check"></i>
                </span>
            </p>
  
        </div>
    </div>
</body>
  
</html>

Output:

Bulma Input with Font Awesome icons

Reference: https://bulma.io/documentation/form/input/#with-font-awesome-icons


Article Tags :