Bulma – Select

  • Post author:
  • Post category:Bulma
  • Post comments:1 Comment
Bulma select

In this guide, we will discuss Select in Bulma.

Description

Bulma select is used when you want to allow the user to pick from multiple options. The select field supports 3 types of modifiers −

  • Color
  • Size
  • State

Colors

The below example describes usage of color modifiers by using classes such as is-primaryis-infois-successis-warning and is-danger in the select field −

<!DOCTYPE html>
<html>
   <head>
      <meta charset = "utf-8">
      <meta name = "viewport" content = "width = device-width, initial-scale = 1">
      <title>Bulma Forms Example</title>
      <link rel = "stylesheet" href = "https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.1/css/bulma.min.css">
      <script src = "https://use.fontawesome.com/releases/v5.1.0/js/all.js"></script>
   </head>
   
   <body>
      <section class = "section">
         <div class = "container">
            <span class = "title">
               Select Field Colors
            </span>
            <br>
            <br>
            
            <span class = "is-size-5">
               Primary Select 
            </span>
            <div class = "field">
               <div class = "control">
                  <div class = "select is-primary">
                     <select>
                        <option>Option One</option>
                        <option>Option Two</option>
                        <option>Option Three</option>
                     </select>
                  </div>
               </div>
            </div>
            <br>
            
            <span class = "is-size-5">
               Info Select 
            </span>
            <div class = "field">
               <div class = "control">
                  <div class = "select is-info">
                     <select>
                        <option>Option One</option>
                        <option>Option Two</option>
                        <option>Option Three</option>
                     </select>
                  </div>
               </div>
            </div>
            <br>
            
            <span class = "is-size-5">
               Success Select 
            </span>
            <div class = "field">
               <div class = "control">
                  <div class = "select is-success">
                     <select>
                        <option>Option One</option>
                        <option>Option Two</option>
                        <option>Option Three</option>
                     </select>
                  </div>
               </div>
            </div>
            <br>
            
            <span class = "is-size-5">
               Warning Select 
            </span>
            <div class = "field">
               <div class = "control">
                  <div class = "select is-warning">
                     <select>
                        <option>Option One</option>
                        <option>Option Two</option>
                        <option>Option Three</option>
                     </select>
                  </div>
               </div>
            </div>
            <br>
            
            <span class = "is-size-5">
               Danger Select 
            </span>
            <div class = "field">
               <div class = "control">
                  <div class = "select is-danger">
                     <select>
                        <option>Option One</option>
                        <option>Option Two</option>
                        <option>Option Three</option>
                     </select>
                  </div>
               </div>
            </div>
            
         </div>
      </section>
      
   </body>
</html>

Sizes

The below example describes different types of sizes by using classes such as is-smallis-medium and is-large of a select field −

<!DOCTYPE html>
<html>
   <head>
      <meta charset = "utf-8">
      <meta name = "viewport" content = "width = device-width, initial-scale = 1">
      <title>Bulma Forms Example</title>
      <link rel = "stylesheet" href = "https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.1/css/bulma.min.css">
      <script src = "https://use.fontawesome.com/releases/v5.1.0/js/all.js"></script>
   </head>
   
   <body>
      <section class = "section">
         <div class = "container">
            <span class = "title">
               Select Field Sizes
            </span>
            <br>
            <br>
            
            <span class = "is-size-5">
               Small Select 
            </span>
            <div class = "field">
               <div class = "control">
                  <div class = "select is-small">
                     <select>
                        <option>Option One</option>
                        <option>Option Two</option>
                        <option>Option Three</option>
                     </select>
                  </div>
               </div>
            </div>
            <br>
            
            <span class = "is-size-5">
               Normal Select 
            </span>
            <div class = "field">
               <div class = "control">
                  <div class = "select">
                     <select>
                        <option>Option One</option>
                        <option>Option Two</option>
                        <option>Option Three</option>
                     </select>
                  </div>
               </div>
            </div>
            <br>
            
            <span class = "is-size-5">
               Medium Select 
            </span>
            <div class = "field">
               <div class = "control">
                  <div class = "select is-medium">
                     <select>
                        <option>Option One</option>
                        <option>Option Two</option>
                        <option>Option Three</option>
                     </select>
                  </div>
               </div>
            </div>
            <br>
            
            <span class = "is-size-5">
               Large Select 
            </span>
            <div class = "field">
               <div class = "control">
                  <div class = "select is-large">
                     <select>
                        <option>Option One</option>
                        <option>Option Two</option>
                        <option>Option Three</option>
                     </select>
                  </div>
               </div>
            </div>
            
         </div>
      </section>
      
   </body>
</html>

States

The select field can be displayed in the different types of states by using classes such as is-hoveredis-focusedis-loading and along with an icon as described in the below example −

<!DOCTYPE html>
<html>
   <head>
      <meta charset = "utf-8">
      <meta name = "viewport" content = "width = device-width, initial-scale = 1">
      <title>Bulma Forms Example</title>
      <link rel = "stylesheet" href = "https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.1/css/bulma.min.css">
      <script src = "https://use.fontawesome.com/releases/v5.1.0/js/all.js"></script>
   </head>
   <body>
      <section class = "section">
         <div class = "container">
            <span class = "title">
               Select Field States
            </span>
            <br>
            <br>
            
            <span class = "is-size-5">
               Normal Select 
            </span>
            <div class = "field">
               <div class = "control">
                  <div class = "select">
                     <select>
                        <option>Option One</option>
                        <option>Option Two</option>
                        <option>Option Three</option>
                     </select>
                  </div>
               </div>
            </div>
            <br>
            
            <span class = "is-size-5">
               Hovered Select 
            </span>
            <div class = "field">
               <div class = "control">
                  <div class = "select">
                     <select class = "is-hovered">
                        <option>Option One</option>
                        <option>Option Two</option>
                        <option>Option Three</option>
                     </select>
                  </div>
               </div>
            </div>
            <br>
            
            <span class = "is-size-5">
               Focused Select 
            </span>
            <div class = "field">
               <div class = "control">
                  <div class = "select is-medium">
                     <select class = "is-focused">
                        <option>Option One</option>
                        <option>Option Two</option>
                        <option>Option Three</option>
                     </select>
                  </div>
               </div>
            </div>
            <br>
            
            <span class = "is-size-5">
               Loading Select 
            </span>
            <div class = "field">
               <div class = "control">
                  <div class = "select is-loading">
                     <select>
                        <option>Option One</option>
                        <option>Option Two</option>
                        <option>Option Three</option>
                     </select>
                  </div>
               </div>
            </div>
            <br>
            <br>
            
            <span class = "title">
               Select Field with Icon
            </span>
            <br>
            <br>
            
            <div class = "field">
               <div class = "control has-icons-left">
                  <div class = "select">
                     <select>
                        <option>Option One</option>
                        <option>Option Two</option>
                        <option>Option Three</option>
                     </select>
                  </div>
                  <div class = "icon is-small is-left">
                     <i class = "fas fa-user"></i>
                  </div>
               </div>
            </div>
            
         </div>
      </section>
      
   </body>
</html>

Next Topic : Click Here

This Post Has One Comment

Leave a Reply