The auth field comes with an optional hint. The hint helps the user filling out the auth field correctly and provides further context. The auth field can also include a counter which can be used for counting the letters and setting minimum or maximum values. The error is shown additionally above the hint if the user made a wrong input. It helps the user understanding the mistake and fixing the input.
When the user fills in the input, the label moves to the top left and the input is displayed in the container. The user can reveal or mask the password input by tapping the visibility toggle. The input should be masked by default.
Empty: the label sits inside the field
Mindestens 8 Zeichen.
→ filling out input: the label moves to the border
Mindestens 8 Zeichen.
Livedefault and filledHTML
<p class="demo-label">Empty: the label sits inside the field</p>
<oc-auth-field-v1><input type="password" id="af-in-1" aria-describedby="af-in-1-hint" aria-required="true" autocomplete="new-password"><label for="af-in-1">Passwort</label><div slot="hint" id="af-in-1-hint">Mindestens 8 Zeichen.</div></oc-auth-field-v1>
<p class="demo-label">→ filling out input: the label moves to the border</p>
<oc-auth-field-v1><input type="password" id="af-in-2" value="otto1" aria-describedby="af-in-2-hint" aria-required="true" autocomplete="new-password"><label for="af-in-2">Passwort</label><div slot="hint" id="af-in-2-hint">Mindestens 8 Zeichen.</div></oc-auth-field-v1>
You can adjust the width of the auth field according to your needs or set it to fill-parent. The height of the container is fixed to 48px. The height of the auth field is set to fit-content and changes when the hint and error are visible.
You can place auth fields and text fields side by side. When placing them horizontally, make sure there is an 8px gap between them. Vertically, there should be a 24px gap.
Side by side, 8px gap
Mindestens 8 Zeichen.
Gib dein Passwort noch einmal ein.
Livehorizontal placementHTML
<p class="demo-label">Side by side, 8px gap</p>
<oc-form-group-v1 orientation="horizontal" flex-behavior="grow" gap="var(--oc-base-dimension-8)" oc-aria-label="Passwort festlegen">
<oc-auth-field-v1><input type="password" id="af-h-1" aria-describedby="af-h-1-hint" aria-required="true" autocomplete="new-password"><label for="af-h-1">Passwort</label><div slot="hint" id="af-h-1-hint">Mindestens 8 Zeichen.</div></oc-auth-field-v1>
<oc-auth-field-v1><input type="password" id="af-h-2" aria-describedby="af-h-2-hint" aria-required="true" autocomplete="new-password"><label for="af-h-2">Passwort wiederholen</label><div slot="hint" id="af-h-2-hint">Gib dein Passwort noch einmal ein.</div></oc-auth-field-v1>
</oc-form-group-v1>
Stacked, 24px gap
Wir schicken dir eine Bestätigung.
Mindestens 8 Zeichen.
Gib dein Passwort noch einmal ein.
Livevertical placementHTML
<p class="demo-label">Stacked, 24px gap</p>
<oc-form-group-v1 orientation="vertical" gap="var(--oc-base-dimension-24)" oc-aria-label="Konto anlegen">
<oc-auth-field-v1><input type="email" id="af-v-1" aria-describedby="af-v-1-hint" aria-required="true" autocomplete="email" spellcheck="false"><label for="af-v-1">E-Mail-Adresse</label><div slot="hint" id="af-v-1-hint">Wir schicken dir eine Bestätigung.</div></oc-auth-field-v1>
<oc-auth-field-v1><input type="password" id="af-v-2" aria-describedby="af-v-2-hint" aria-required="true" autocomplete="new-password"><label for="af-v-2">Passwort</label><div slot="hint" id="af-v-2-hint">Mindestens 8 Zeichen.</div></oc-auth-field-v1>
<oc-auth-field-v1><input type="password" id="af-v-3" aria-describedby="af-v-3-hint" aria-required="true" autocomplete="new-password"><label for="af-v-3">Passwort wiederholen</label><div slot="hint" id="af-v-3-hint">Gib dein Passwort noch einmal ein.</div></oc-auth-field-v1>
</oc-form-group-v1>
Best practices
DoOnly place related auth fields and text fields horizontally next to each other.
Don'tPlace unrelated auth fields and text Fields horizontally next to each other.
Content guidelines
DoUse short, precise labels to describe the required input.Don'tUse overly descriptive labels to describe the required input.DoProvide clear an useful error to help the user fix the issue.Don'tUse generic errors, such as "Die Eingabe ist fehlerhaft".
Accessibility
For information on accessibility, refer to the technical documentation.
The auth field component is an alternative to the auth field component to support password managers.
This component is designed to be used in a login form or any other form where credentials are required.
Note: Not all password managers are able to handle shadow DOM, so this component is a workaround to support them.
The auth field component offers styling variants such as default and error.
This component is configurable, allowing you to tailor its features and appearance to your specific needs.
To explore all the available options and adjust the component, use the component configurator and see the changes affect the component in real-time.
Usage guidelines
Before integrating the auth field component into your project, make sure you have correctly installed the OTTO components package.
Look through the variations page for examples of possible component variations.
Here, you can discover both common and specific variations that address different use cases.
This component has visual overflow.
It extends beyond its bounding box and is clipped by parent containers with overflow: hidden.
Ensure the parent container has sufficient padding to accommodate the component's full visual area.
To make the auth field recognizable for screen readers, use the default slot to provide a clear and descriptive label.
Use the aria-label attribute on the label to provide additional context if the visible label is not sufficient.
See the general accessibility documentation for guidance on using oc-aria-label, including how it works with link and masked link behavior.
Invalidate the auth field
If the auth field is invalid, the aria-invalid attribute must be set to true on the input element.
You should also provide an error message to the user by using the error slot and reference it in the aria-describedby attribute on the input element.
Configure the auth field component with the controls below and see the changes live in the preview canvas.
Click the Show code button within the preview canvas to see the source code for the current component configuration.
Interactive configurator (Storybook controls); every option is listed in the API section of this file.
API v1
Auth Field v1 API
API: <oc-auth-field-v1> (AuthFieldV1)
The auth field component provides a single-line input field for user text input. It is mainly used for login forms or registration forms. The component consists of an input field and a label. The input field can be of type text, email, or password. The component can be styled in a default or error state.
Attributes / properties
Attribute
Type
Default
Required
Description
variant
"default" | "error"
"default"
no
Sets the main styling and behavior of the auth field.
password-visible
boolean
false
no
Allows to programmatically synchronize the toggle state of the password visibility for multiple password fields, e.g. for password confirmation. As a result, both toggle buttons show and hide the password value of both password fields simultaneously. This attribute is only available for auth field components with type="password".
show-counter
boolean
false
no
Indicates whether a counter for minlength or maxlength is shown.
Note:minlength and maxlength attributes need to be set on the input element.
without-optional-label
boolean
false
no
Excludes the automatic "(optional)" label suffix even if the feature toggle is active.
Slots
Slot
Required
Description
default
yes
The input and label elements for the auth field. Both elements need to be present and should be linked by the for attribute of the label element.
Note: Order is important. The input element needs to be before the label element.
hint
no
Hint for the input field.
The hint needs to be referenced by the aria-describedby attribute of the input element.
error
no
The error message for the input field.
The error needs to be referenced by the aria-describedby attribute of the input element.
aria-invalid should set to true on the input field.
Events
Event
Detail type
Description
oc-property-change
OcAuthFieldV1Events["oc-property-change"]
Whenever a property value changes, this event triggers. Use this event to track all property changes within the component.
Fired when the component is mounted to the DOM. The event is fired when the onMount hook of the component is called by the runtime.
oc-unmount
{ component: string; }
Fired when the component is unmounted from the DOM. The event is fired when the function returned by the onMount hook of the component is called by the runtime.
Variations (v1)
Variations
Listed below are the most common variations of the auth field component as well as specific component variations for different use cases.
You can explore all available options using the component configurator, adjust the component to your needs, and see the changes live in a preview canvas.