Name form

Collect a full name as separate elements of data

<form class="usa-form">
  <fieldset class="usa-fieldset">
    <legend class="usa-legend">Name</legend>
    <label class="usa-label" for="title">Title <span class="usa-hint">(optional)</span></label>
    <input class="usa-input usa-input--small" id="title" name="title" type="text">

    <label class="usa-label" for="first-name">First name</label>
    <input class="usa-input" id="first-name" name="first-name" type="text" required aria-required="true">

    <label class="usa-label" for="middle-name">Middle name <span class="usa-hint">(optional)</span></label>
    <input class="usa-input" id="middle-name" name="middle-name" type="text">

    <label class="usa-label" for="last-name">Last name</label>
    <input class="usa-input" id="last-name" name="last-name" type="text" required aria-required="true">

When to use a name form

  • You need separate data elements. When you need to collect users’ full names and store the parts separately in a database.

When to consider something else

  • You don’t need separate data elements. If you don’t need to parse out the separate pieces of a person’s name, consider letting them enter it into a single text field.

Usability guidance

  • Avoid dropdowns. Leave the title and suffix fields as text boxes instead of offering dropdowns. There are many possible titles and suffixes; text boxes accommodate them all.
  • Don’t restrict characters. Do not restrict the types of characters users can enter in any of these fields. Names can include characters outside the standard Roman alphabet.


Package information

  • Package usage: @import form-templates
  • Requires: required, global