Inputs

A user input element that allows for the exchange of information between the user and a form owner.

Coded Components

Helper classes: Looking for a complete list of helper classes for these components?View helper classes

Redlines: We don't include redline comps because it's always more accurate to use developer tools to inspect the coded components, or a plugin such as the Prism Redline Tool.

Text Input

<div class="dds__form-group"> <label for="name-3">First Name</label> <input type="text" class="dds__form-control" placeholder="e.g. Jane Doe" maxlength="256" name="name-3" id="name-3">
</div>

Text Input Disabled

<div class="dds__form-group"> <label for="disabledTextInput">Second Choice</label> <input type="text" id="disabledTextInput" class="dds__form-control" disabled=""> </div>

Text Input Read-Only

<div> <label for="readonlyTextInput">Case Number</label> <input type="text" id="readonlyTextInput" class="dds__form-control" value="987654" readonly="">
</div>

Text Area

<div class="dds__form-group"> <label for="exampleFormControlTextarea1">Please provide details about your request</label> <textarea class="dds__form-control" id="exampleFormControlTextarea1" rows="3"></textarea> </div>

Email Address

<div class="dds__form-group"> <label for="email">Email</label> <input type="email" class="dds__form-control" maxlength="256" name="email" id="email"> </div>

Password

<form data-toggle="dds__form-validation"><div class="dds__form-group"> <label for="password">Password</label> <input type="password" class="dds__form-control" maxlength="256" name="password" id="password" aria-describedby="PasswordHelpBlock" /> <small id="PasswordHelpBlock" class="dds__form-text dds__text-muted"> Password must be 8-20 letters and numbers with no spaces, special characters or emoji. </small> <div class="dds__form-check"> <label class="dds__form-check-label" for="checkboxPassword"> <input type="checkbox" id="checkboxPassword" name="checkboxPassword" class="dds__form-check-input" data-target="password" /> <span>Show Password</span> </label> </div>
</div></form>

Phone Number

<form data-toggle="dds__form-validation"><div class="dds__form-group"> <label for="phoneInput">Phone</label> <input id="phoneInput" type="text" placeholder="(___) ___-____" set-cursor="1" data-toggle="dds__input-mask" class="dds__form-control dds__input-masked" data-charset="(XXX) XXX-XXXX" required/> </div></form>

File Input/Upload

<div class="dds__form-group dds__form-group-upload"> <label for="uploadInput">File Upload Label</label> <div class="dds__form-upload-wrapper"> <input type="file" class="dds__form-upload" data-toggle="dds__form-upload" name="upload" id="uploadInput" data-max-size="1mb" data-placeholder="Only pdf 1MB maximum" tabindex="-1" required /> <Button type="button" for="uploadInput" class="dds__form-upload-btn"> <i class="dds__icons dds__upload dds__icon-grid-item"></i> Upload File </Button> </div> <div class="dds__invalid-feedback" id="uploadInputFeedback"> Please upload file. </div>
</div>

Form with Errors

<div> <form data-toggle="dds__form-validation" novalidate="false"> <div class="dds__form-group"> <label for="input-error-emailInput-validation">Email label</label> <input type="email" class="dds__form-control" maxlength="256" name="email" id="input-error-emailInput-validation" required aria-invalid="false" aria-describedby=""> <div class="dds__invalid-feedback" id="input-error-emailInput-validationFeedback"> Please enter your email. </div> </div> <div class="dds__form-row"> <div class="dds__col-md-4 dds__mb-3"> <label for="input-error-firstnameInput-validation">First name</label> <input type="text" class="dds__form-control" name="first_name" id="input-error-firstnameInput-validation" required aria-invalid="false" aria-describedby=""> <div class="dds__invalid-feedback" id="input-error-firstnameInput-validationFeedback"> Please enter your first name. </div> </div> <div class="dds__col-md-4 dds__mb-3"> <label for="input-error-lastnameInput-validation">Last name</label> <input type="text" class="dds__form-control" name="last_name" id="input-error-lastnameInput-validation" required aria-invalid="false" aria-describedby=""> <div class="dds__invalid-feedback" id="input-error-lastnameInput-validationFeedback"> Please enter your last name. </div> </div> <div class="dds__col-md-4 dds__mb-3"> <label for="input-error-usernameInput-validation">Username</label> <input type="text" class="dds__form-control" name="username" id="input-error-usernameInput-validation" required aria-invalid="false" aria-describedby=""> <div class="dds__invalid-feedback" id="input-error-usernameInput-validationFeedback"> Please choose a username. </div> </div> </div> <div class="dds__form-row"> <div class="dds__col-md-6 dds__mb-3"> <label for="input-error-cityInput-validation">City</label> <input type="text" class="dds__form-control" name="city" id="input-error-cityInput-validation" required aria-invalid="false" aria-describedby=""> <div class="dds__invalid-feedback" id="input-error-cityInput-validationFeedback"> Please provide a valid city. </div> </div> <div class="dds__col-md-3 dds__mb-3"> <label for="input-error-stateInput-validation">State</label> <input type="text" placeholder="texas" class="dds__form-control" name="state" id="input-error-stateInput-validation" required aria-invalid="false" aria-describedby=""> <div class="dds__invalid-feedback" id="input-error-stateInput-validationFeedback"> Please provide a valid state. </div> </div> <div class="dds__col-md-3 dds__mb-3"> <label for="input-error-zipcodeInput-validation">Zip</label> <input id="input-error-zipcodeInput-validation" type="text" name="zip" placeholder="#####" pattern="[1-9]{1}[0-9]{4}" class="dds__form-control dds__input-masked" data-charset="XXXXX" required pattern="^[0-9]{5}(?:-9]{4})?$" aria-invalid="false" aria-describedby=""> <div class="dds__invalid-feedback" id="input-error-zipcodeInput-validationFeedback"> Please provide a valid zip. </div> </div> </div> <div class="dds__form-row"> <div class="dds__col-md-3 dds__mb-3"> <label for="input-error-phoneInput-validation">Phone</label> <input id="input-error-phoneInput-validation" type="text" name="phone" placeholder="(___) ___-____" set-cursor="1" pattern="\([1-9]{1}[0-9]{2}\) [0-9]{3}-[0-9]{4}" class="dds__form-control dds__input-masked" data-charset="(XXX) XXX-XXXX" required/> <div class="dds__invalid-feedback" id="input-error-phoneInput-validationFeedback"> Please provide a valid phone. </div> </div> </div> <button class="dds__btn dds__btn-primary" type="submit">Submit form</button>
</form> </div>

No items found.

No items found.

Heading

No items found.

Usage

Overview

A text input or text area should be used when:

  • You can’t reasonably predict a user’s answer to a prompt and there might be wide variability in users’ answers.
  • Another type of input would make answering more difficult. For example, dates are easier to type in than they are to select from a calendar picker.
  • Users might want to be able to copy-and-paste in a response.

The length of the text input provides a hint to users as to how much text to write. Don't require users to write paragraphs of text into a single-line input, and use a shorter input to reinforce the length of a postal code.

Only show error validation after a user has finished interacting with an input. For example, after the field loses focus, the user presses Enter on the keyboard, or clicks a Submit button.

Avoid breaking numbers with distinct sections (such as phone numbers, Social Security Numbers, or credit card numbers) into separate input fields. For example, use one input for a phone number and not three (one for area code, one for local code, and one for number). Each field needs to be labeled for a screen reader and the labels for fields would be broken into segments that are not meaningful.

Labels

The correct placement for an input's label is above the input and left-aligned.

Display input labels that are clear and concise, although on smaller breakpoints labels can wrap.

Input labels should default to Title Case so long as the label is short, or when the input itself also uses Title Case. Use sentence case if the label reads like a complete sentence.

Inputs that are optional must be labeled as optional. The recommended method is to append " (Optional)" to the end of the input label.

Do not use an asterisk * to indicate required inputs because screen readers are inconsistent in the way that they read them.

Placeholder Text

An error prevention pattern that's used to offer clues about the data format expected within an input.

Avoid using placeholder text that serves as an input label or instruction. If placeholder text is no longer visible after users click into a field, users will no longer have that text available when they need to review their entries for accuracy. People who have cognitive or visual disabilities have additional problems with placeholder text.

Contextual Help

Contextual help may appear immediately beneath an input as a line of text or a tooltip.

Provides instruction so that users can complete a form without error.

Try not to exceed 8-10 words.

Grouping Inputs into Forms

Remove all non-required inputs in order to increase the completion rate of forms.

Alternatively, a form can reveal additional inputs when a prerequisite input is completed.

Use HTML 5 standards, so that mobile devices can benefit from improved features, for the following inputs:

  • Email
  • Web Address
  • Search
  • Number (spinboxes, sliders)

Errors

A form validation checks user input against success criteria before passing the data to the server.

If there's at least one error, then a notification is displayed at top of page, below the page title, and it includes a list of anchor links to input-level errors. See Notifications for more details.

Do's and Don'ts

Common Button Labels and Usage

Title case, 2-3 words maximum.
Do not combine actions in a label (exception: "Customize & Buy").
If standard labels don't fit the button's purpose, align label with the task the user is attempting.

Please refer to the Dell Technologies branding website, https://brand.delltechnologies.com/faq/#voice, for further information regarding call-to-action labels and usage.

Button Label:
Corresponding Action:
Add to Cart
Search
Cancel
Save
Edit
Delete
Continue
Next/Previous
Submit
Select
Sign In/Sign Out
View Details
Ok/Cancel
Learn More
Close
Takes users to Cart page, with item added
Used for search buttons
Takes users back to entry point for a task
Used to save an item
Navigates users to change an item
Deletes an item on the page, usually with a verification step
Used as progression
Used as forward and backward navigation (Next is primary, Previous is secondary)
Used to submit a task or info
Used for choosing items in a task flow
Authentication standard, for consistency do not use Log In/Log Out or Signin/Signout
Used instead of “Select” in cases of product details or within learn content
For use in modal verification steps when more specific CTAs will not fit due to space
Used to link users to more learning content or contextual help
Used within modal windows

Accessibility

The A11Y Style Guide has excellent examples of markup for inputs.

The W3C Web Accessibility Initiative (WAI) develops standards and support materials to help you understand and implement accessibility.

Please follow the best practices for forms from WAI-ARIA authoring practices 1.1.

Please also refer to these recommendations for inputs and recommendations for form landmarks from WAI-ARIA 1.1.

You may refer to this example of a form landmark from WAI-ARIA practices 1.1.

You may also refer to these tutorials for forms from Web Accessibility Tutorials.

you may also refer to this article about creating accessible forms from WebAIM.