Components

Text inputs

Text inputs allow the user to enter any combination of letters, numbers, or symbols. Text input fields can span single or multiple lines.

Types

Text input

Use when the expected user input is a single line of text, for example email addresses, names, or search queries. The length of the input field should be proportional to the expected user input, so that the user can see what they’ve typed without having to scroll to reveal hidden content.

States










Validation status





HTML code snippet

<!--States are shown for demonstration purposes only-->

<h4>
States
</h4>
<input class="a-text-input"
      type="text"
      id="textinput-example-default"
      placeholder="Placeholder text"
value="Enabled">
<br><br>
<input class="a-text-input hover"
       type="text"
       id="textinput-example-hover"
       placeholder="Placeholder text"
       value="Hover">
<br><br>
<input class="a-text-input focus"
       type="text"
       id="textinput-example-focus"
       placeholder="Placeholder text"
       value="Focus">
<br><br>
<input class="a-text-input"
       type="text"
       id="textinput-example-disabled"
       placeholder="Disabled"
       disabled>
<br>
<br>
<br>

<h4>
Validation status
</h4>
<input class="a-text-input a-text-input--success" type="text" placeholder="Success" id="form-input-success" aria-describedby="form-input-success_message">
<br><br>
<input class="a-text-input a-text-input--warning" type="text" placeholder="Warning" id="form-input-warning" aria-describedby="form-input-warning_message">
<br><br>
<input class="a-text-input a-text-input--error" type="text" placeholder="Error" id="form-input-error" aria-describedby="form-input-error_message">

Text input (full width)

HTML code snippet

<div class="m-form-field">
    <input class="a-text-input a-text-input--full"
          type="text"
          id="full-textinput-example"
placeholder="Placeholder text"
value="Input text">
</div>

Search input

Use for search inputs.

HTML code snippet

<form>
    <div class="o-search-input">
        <div class="o-search-input__input">
            <label for="example-search-text" class="o-search-input__input-label" aria-label="Search for a term">
              
            </label>
            <input type="search" id="example-search-text" name="example-search-text" value="" class="a-text-input a-text-input__full" placeholder="Enter your search term(s)" title="Enter your search term(s)" autocomplete="off" maxlength="75">
            <button type="reset" onclick="document.getElementById('example-search-text').setAttribute('value','')" aria-label="Clear search" title="Clear search">
              
            </button>
        </div>
        <button class="a-btn" type="submit" aria-label="Search for term(s)">
            Search
        </button>
    </div>
</form>

Text area input

Text area input

Use when the expected user input is more than a few words and could span multiple lines. Make sure the input size is big enough that the user can see what they’ve typed without having to scroll to reveal hidden content, and small enough that the user doesn’t have to navigate the viewport in order to see the entire field at once.

HTML code snippet

<textarea class="a-text-input"
          id="textarea-example-default"
          placeholder="Placeholder text">Input text</textarea>

Text area input (full width)

HTML code snippet

<div class="m-form-field">
    <textarea class="a-text-input a-text-input--full"
              id="full-textarea-example"
           placeholder="Placeholder text">Input text</textarea>
</div>

Latest Updates

Page last edited:
Show all details
Edit page