Agriculture Design System
Design System for the Export Service

Password input

The password input component allows users to securely enter a password. The text is obscured by default, but can be revealed by pressing the "Show password" checkbox.

View in FigmaView in StorybookView in Github
import { ... } from '@ag.ds-next/react/password-input';
Open in Playroom, opens in a new tab
<PasswordInput label="Password" required />


  • use to hide characters as a user enters their password
  • obscure the password by default


  • use for anything else besides passwords
  • display the password by default


Use the hint prop to provide help that’s relevant to the majority of users, like how their information will be used, or where to find it.

Don't use long paragraphs and lists in hint text. Screen readers read out the entire text when users interact with the form element. This could frustrate users if the text is long.

Don't include links within hint text. While screen readers will read out the link text when describing the field, they will not tell users that the text is a link.

<PasswordInput label="Password" hint="Hint text" required />


The required prop can be used to indicate that user input is required on the field before a form can be submitted.

Using the required prop, this component will automatically append "(optional)" to the label as well as using aria-required to indicate to screen reader user that the field is required.

Hide optional label

The hideOptionalLabel prop can be used in situations where you want to indiciate to screen reader users that a field is optional but don't want to show the "(optional)" label.

The usage of hideOptionalLabel should be reserved for inputs that filter data in a table or chart, and should never be used in standard forms for submitting information.

<Stack gap={1}>
	<PasswordInput label="Required" required />
	<PasswordInput label="Optional" required={false} />
		label="Optional with hideOptionalLabel"


Use the invalid prop to indicate if the user input is invalid (does not validate according to the elements settings).

	message="Enter your password"


Disabled input elements are unusable and can not be clicked. This prevents a user from interacting with the input element until another action is complete. Disabled input elements in a form will not be submitted.

<PasswordInput label="Password" value="abc123" disabled required />

Maximum widths

The width of a text input field should indicate the amount of information expected to be entered into the field. The size of the text input acts as a visual constraint for the end user.

As an example, input fields for postcodes should have a smaller width than fields for emails.

<Stack gap={1}>
	<PasswordInput label="md input" maxWidth="md" required />
	<PasswordInput label="lg input" maxWidth="lg" required />
	<PasswordInput label="xl input" maxWidth="xl" required />


Use the block prop to expand the component to fill the available space.

<PasswordInput label="Password" block required />
  • Text input This component allows users to enter free-form text.