- Add styling for number input (#133)

- Update docs to show styling for more fields
This commit is contained in:
Isiah Lloyd 2022-05-21 20:57:24 -04:00 committed by GitHub
parent ec33cdb93b
commit 7412a98815
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 7 deletions

View file

@ -391,15 +391,35 @@
`) %> `) %>
<p> <p>
Text boxes can also be disabled and have value with their corresponding HTML attributes. Text boxes can also be disabled and have value with their corresponding HTML attributes.
</p> </p>
<%- example(` <%- example(`
<div class="field-row"> <div class="field-row">
<label for="text${getNewId()}">Favorite color</label> <label for="text${getNewId()}">Favorite color</label>
<input id="text${getCurrentId()}" disabled type="text" value="Windows Green"/> <input id="text${getCurrentId()}" disabled type="text" value="Windows Green"/>
</div> </div>
`) %> `) %>
<p>
Other types of HTML5 text inputs are also supported.
</p>
<%- example(`
<div class="field-row-stacked" style="width: 200px">
<label for="text${getNewId()}">Email</label>
<input id="text${getCurrentId()}" type="email" value="admin@contoso.com"/>
</div>
<div class="field-row-stacked" style="width: 200px">
<label for="text${getNewId()}">Password</label>
<input id="text${getCurrentId()}" type="password" value="hunter2"/>
</div>
<div class="field-row-stacked" style="width: 200px">
<label for="text${getNewId()}">Favorite Number</label>
<input id="text${getCurrentId()}" type="number" value="98"/>
</div>
`) %>
</div> </div>
@ -548,7 +568,7 @@
assistive technologies know the intent of this button. You may also use assistive technologies know the intent of this button. You may also use
"Minimize", "Maximize", "Restore" and "Help" like so: "Minimize", "Maximize", "Restore" and "Help" like so:
</p> </p>
<%- example(` <%- example(`
<div class="title-bar"> <div class="title-bar">
<div class="title-bar-text">A Title Bar</div> <div class="title-bar-text">A Title Bar</div>
@ -578,7 +598,7 @@
<button aria-label="Help"></button> <button aria-label="Help"></button>
<button aria-label="Close"></button> <button aria-label="Close"></button>
</div> </div>
</div> </div>
`) %> `) %>
<p> <p>
You can make a title bar "inactive" by adding <code>inactive</code> class, You can make a title bar "inactive" by adding <code>inactive</code> class,
@ -663,7 +683,7 @@
</blockquote> </blockquote>
<p> <p>
You can render a status bar with the <code>status-bar</code> class, You can render a status bar with the <code>status-bar</code> class,
and <code>status-bar-field</code> for every child text element. and <code>status-bar-field</code> for every child text element.
</p> </p>
@ -688,7 +708,7 @@
</div> </div>
`) %> `) %>
</section> </section>
<section class="component"> <section class="component">

View file

@ -422,6 +422,7 @@ input[type="checkbox"][disabled]:checked + label::after {
input[type="text"], input[type="text"],
input[type="password"], input[type="password"],
input[type="email"], input[type="email"],
input[type="number"],
select, select,
textarea { textarea {
padding: 3px 4px; padding: 3px 4px;
@ -441,10 +442,15 @@ input[type="email"],
select { select {
height: 21px; height: 21px;
} }
input[type="number"] {
/* need this 1 pixel to fit the spinner controls in box */
height: 22px;
}
input[type="text"], input[type="text"],
input[type="password"], input[type="password"],
input[type="email"] { input[type="email"],
input[type="number"] {
/* For some reason descenders are getting cut off without this */ /* For some reason descenders are getting cut off without this */
line-height: 2; line-height: 2;
} }
@ -452,6 +458,7 @@ input[type="email"] {
input[type="email"]:disabled, input[type="email"]:disabled,
input[type="password"]:disabled, input[type="password"]:disabled,
input[type="text"]:disabled, input[type="text"]:disabled,
input[type="number"]:disabled,
textarea:disabled { textarea:disabled {
background-color: var(--surface); background-color: var(--surface);
} }
@ -472,6 +479,7 @@ select:focus,
input[type="text"]:focus, input[type="text"]:focus,
input[type="password"]:focus, input[type="password"]:focus,
input[type="email"]:focus, input[type="email"]:focus,
input[type="number"]:focus,
textarea:focus { textarea:focus {
outline: none; outline: none;
} }