|
| 1 | +--- |
| 2 | +title: Dropdown Select |
| 3 | +minver: 0.16.0 |
| 4 | +also: |
| 5 | + components/dropdown-select/test.html: Testing - Dropdown Select |
| 6 | +--- |
| 7 | +{% extends 'component.njk' %} |
| 8 | +{% block content %} |
| 9 | + <p class="comfortable"> |
| 10 | + The {{page.title}} component provides markup that enables a consistent |
| 11 | + visual appearance of the HTML <code><select></code> element. |
| 12 | + </p> |
| 13 | + |
| 14 | + <section> |
| 15 | + <h2 id="basic-select">Basic Select</h2> |
| 16 | + <div class="example" id="vue-selectDemo" v-cloak> |
| 17 | + <header> |
| 18 | + <form class="beta-hxForm"> |
| 19 | + <fieldset> |
| 20 | + <legend class="beta-hxFieldName">Options</legend> |
| 21 | + <div> |
| 22 | + <input id="chkRequired" type="checkbox" v-model="isRequired" /> |
| 23 | + <label for="chkRequired">Required</label> |
| 24 | + </div> |
| 25 | + <div> |
| 26 | + <input id="chkDisabled" type="checkbox" v-model="isDisabled" /> |
| 27 | + <label for="chkDisabled">Disabled</label> |
| 28 | + </div> |
| 29 | + </fieldset> |
| 30 | + </form> |
| 31 | + </header> |
| 32 | + |
| 33 | + <div> |
| 34 | + <div class="hxSelect"> |
| 35 | + <select |
| 36 | + id="selDemo" |
| 37 | + :disabled="isDisabled" |
| 38 | + :required="isRequired" |
| 39 | + > |
| 40 | + <option value="">-- Please Select --</option> |
| 41 | + <option value="1">Option 1</option> |
| 42 | + <option value="2">Option 2</option> |
| 43 | + <option value="3">Option 3</option> |
| 44 | + </select> |
| 45 | + <hx-select></hx-select> |
| 46 | + <label for="selDemo"> |
| 47 | + Choose an Option |
| 48 | + </label> |
| 49 | + </div> |
| 50 | + </div> |
| 51 | + |
| 52 | + <footer> |
| 53 | + <pre><code v-text="snippet"></code></pre> |
| 54 | + </footer> |
| 55 | + </div> |
| 56 | + <div app-loading class="hxBox hxLg"> |
| 57 | + <hx-busy></hx-busy> |
| 58 | + <p>Loading...</p> |
| 59 | + </div> |
| 60 | + <p class="hxSubBody hxSubdued"> |
| 61 | + <hx-icon type="info-circle"></hx-icon> |
| 62 | + <code><select></code> must be defined before |
| 63 | + <code><hx-select></code> and <code><label></code> |
| 64 | + for styles to be effective. |
| 65 | + </p> |
| 66 | + <p class="hxSubBody hxSubdued"> |
| 67 | + <hx-icon type="info-circle"></hx-icon> |
| 68 | + Extra elements will be hidden. |
| 69 | + </p> |
| 70 | + </section> |
| 71 | + |
| 72 | + <section> |
| 73 | + <h2 id="validation">Validation</h2> |
| 74 | + <p class="comfortable"> |
| 75 | + A {{page.title}} is designed to take advantage of standardized |
| 76 | + <a href="https://mzl.la/2SuKTmv">HTML form validation</a> capabilities. |
| 77 | + Error styles will be applied as long as the <code><select></code> |
| 78 | + element matches the <code>:invalid</code> CSS pseudo-class. |
| 79 | + </p> |
| 80 | + <p> |
| 81 | + There are two ways to modify validity of the |
| 82 | + <code><select></code> element. |
| 83 | + </p> |
| 84 | + <ol class="hxList"> |
| 85 | + <li> |
| 86 | + add or remove the <code>required</code> attribute |
| 87 | + </li> |
| 88 | + <li> |
| 89 | + calling its |
| 90 | + <a href="https://mzl.la/2MQYTkd"> |
| 91 | + <code>setCustomValidity()</code> |
| 92 | + </a> method |
| 93 | + </li> |
| 94 | + </ol> |
| 95 | + </section> |
| 96 | +{% endblock %} |
0 commit comments