Open In App

Materialize CSS Select

Last Updated : 01 Jun, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

Materialize provides a select feature to create options that can be easily selected to provide more information for the web forms. The following are different select feature:

  • simple select-option: allows to select an option from select dropdown. For this, <select> and <option> tags are used.
  • select dropdown with multiple selection of options: allows to select more than one option from select dropdown. For this, multiple attribute are used in <select> tag.
  • select dropdown with option groups: allows to select from a list is a category based from select dropdown.
  • select dropdown with images: allows to display images with options.
  • select dropdown with browser defaults: it can be used with default class in select tag.

Disabled Styles: 
 

Materialize select provides disabled feature that has its own use. To make whole thing unselectable, add disabled attribute to the select element and to disable individual options  then add disabled to the options.

 

Example:

 

html




<!DOCTYPE html>
<html>
    <head>
        <!--Import Google Icon Font-->
        <link href=
              rel="stylesheet" />
 
        <!-- Compiled and minified CSS -->
        <link rel="stylesheet"
              href=
        <script type="text/javascript"
                src=
      </script>
        <script src=
      </script>
 
        <!--Let browser know website
            is optimized for mobile-->
        <meta name="viewport"
              content=
              "width=device-width, initial-scale=1.0" />
    </head>
 
    <body class="container">
        <div class="row">
            <form class="col s12">
                <div class="row">
                    <label>Select</label>
                    <div class="select1 green-text">
                        <select>
                            <option value=""
                                    disabled selected>
                              Select Topic
                          </option>
                            <option value="1">
                              Machine Learning</option>
                            <option value="2">
                              Web Development</option>
                            <option value="3">
                              Language</option>
                        </select>
                    </div>
                </div>
 
                <div class="row green-text">
                    <label>Multi Select</label>
                    <select multiple>
                        <option value=""
                                disabled selected>
                          Select Topic</option>
                        <option value="1">
                          Machine Learning</option>
                        <option value="2">
                          Web Development</option>
                        <option value="3">
                          Language</option>
                    </select>
                </div>
 
                <div class="row green-text">
                    <label>Select with Optgroup</label>
                    <select>
                        <optgroup label="Web Development">
                            <option value="1">
                              HTML</option>
                            <option value="2">
                              CSS</option>
                            <option value="3">
                              JavaScript</option>
                        </optgroup>
 
                        <optgroup label="Language">
                            <option value="4">
                              Python</option>
                            <option value="5">
                              C</option>
                            <option value="6">
                              Java</option>
                        </optgroup>
                    </select>
                </div>
 
                <div class="row green-text">
                    <label>Select with images</label>
                    <select class="icons">
                        <option value=""
                                disabled selected>
                          Select Technology</option>
                        <option value="1"
                                data-icon=
                                class="circle"> HTML</option>
                        <option value="2">JavaScript</option>
                        <option value="3">CSS</option>
                    </select>
                </div>
 
                <div class="row green-text">
                    <label>Browser default Select</label>
                    <select class="browser-default">
                        <option value=""
                                disabled selected>
                          Select Topic</option>
                        <option value="1">
                          Machine Learning</option>
                        <option value="2">
                          Web Development</option>
                        <option value="3">
                          Language</option>
                    </select>
                </div>
 
                <div class="row green-text">
                    <label>
                      Disabled Materialize Select</label>
                    <label>
                      Disabled Materialize Select</label>
                    <select disabled>
                        <option value=""
                                disabled selected>
                          Select Topic</option>
                        <option value="1">
                          Machine Learning</option>
                        <option value="2">
                          Web Development</option>
                        <option value="3">
                          Language</option>
                    </select>
                </div>
 
                <div class="row green-text">
                    <label>Disabled Browser
                      default Select</label>
                    <select class="browser-default"
                            disabled>
                        <option value=""
                                disabled selected>
                          Select Topic</option>
                        <option value="1">
                          Machine Learning</option>
                        <option value="2">
                          Web Development</option>
                        <option value="3">
                          Language</option>
                    </select>
                </div>
            </form>
        </div>
 
        <script>
            $(document).ready(function () {
                $("select").material_select();
            });
        </script>
        <!-- Compiled and minified JavaScript -->
        <script src=
      </script>
    </body>
</html>


Output:



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads