GC Design System Components
Home Start to use Page templates overview Basic page Components overview Breadcrumbs Button Card Checkboxes Container Date input Date modified Details Error message Error summary Fieldset File uploader Footer Grid Header Heading Icon Input Language toggle Link Notice Pagination Radios Screenreader-only Search Select Side navigation Signature Stepper Text Textarea Theme and topic menu Top navigation CSS shortcuts overview Reset styles Responsive layout State Box sizing Container sizing Display Overflow Position Visibility Font Font family Font size Font style Font weight Line height Link colour Link size Link text decoration List style Text align Text colour Text overflow Text transform Word break Margin Padding Align content Align items Align self Flex Flex direction Flex grow Flex shrink Flex wrap Gap Grid columns Grid rows Justify content Justify items Justify self Order Place content Place items Place self Background colour Border colour Border radius Border style Border width Icon names Icon size Image Cursor Pointer events Transition Styles overview Design tokens Colour tokens Spacing tokens Typography tokens Contact us Get involved Find a demo

Input
<gcds-input>

Also called: text input, input field.

An input is a space to enter short-form information in response to a question or instruction.

Input component preview

Input anatomy

  1. The input label states the information a person should enter in the field. Label text is left aligned and in sentence case (only the initial letter is capitalized).
  2. The hint text communicates specific requirements for each input to support task success.
  3. The field is the container a person interacts with to provide their response.
Input anatomy showing the Input label, Hint text/ example message and dark blue outline white box for text input.

Design and accessibility for inputs

Write a short, specific, unique input label

  • Ask for the information you need using as few words as possible. Phrasing as a question can make a label unnecessarily long and a person may not read the whole thing.
  • Choose unique labels for each input and text area within a page, like "Your full name", "Manager's name".
  • Avoid using technical jargon, like "subject email address" or "account ID". Instead be specific and personal, like "full name", "child's age".
  • Avoid using colloquialisms and common verb phrases that are unfamiliar to non-fluent speakers.
  • Explain any term that may not be clear. For example, "Handle (name you'd like to go by)".

Size inputs to fit response type

  • Use fixed width inputs for content you know has a specific length. For example, 6 characters for a postal code or 10 characters for a phone number.
  • Opt to use most of the container width when you do not know the character count of the response and use all 75 characters for responses without a fixed length.
  • Avoid using inputs for responses that may need more than 75 characters.

Support task success with hint text

  • Add hint text to help a person filling in an input to provide a complete value.
  • Write hint text to be instructional, brief and specific.

Write error messages for required inputs

  • Use error messages to address missing and invalid entries.
  • Write an error message for all required inputs. If a field is optional, avoid using an error message.
  • Avoid blaming the person using the product. Instead, tell them exactly what to do to move forward.

Help us improve

Have questions or a request? Give feedback on our contact form.

Something's wrong? Raise it through GitHub with an account. You'll have access to the team's direct responses, progress made on your issue, and issues raised by others.

Give feedback Report an issue on GitHub
2024-12-11