Vivid Logo Vivid

Text Field

The Text Field component is used to allow users to provide text input when the expected input is short. As well as plain text, Text Field supports various types of text, including passwords, email addresses and telephone numbers.

Labelling

Label Text

The label attribute provides a short description of the purpose of the Text Field.

If a visible label can't be used, provide one using the aria-label attribute. This ensures screen readers announce the purpose of the element, making it accessible to all users.

Helper Text

The helper-text attribute provides additional information to help the user enter the correct information.

To add HTML to the helper text, use the helper-text slot.

Placeholder Text

The placeholder attribute provides an example of the type of input the user needs to enter.

Avoid using placeholder text as a substitute for a label. Placeholder text is not a reliable label—it disappears when users type and is not always announced by screen readers. Use a label element to ensure the Combobox is both visually and programmatically associated with a descriptive label.

Character Count

The char-count attribute can be use in combination with the maxlength attribute to provide a visual character count.

Contextual Help

You can add the Contextual Help component using the contextual-help slot. It will be displayed next to the label, providing users additional information.

Value

The value attribute can be used the set the default value for the Text Field input element.

Validation Feedback

Error Text

The error-text attribute provides a custom error message. Any current error state will be overridden by error-text.

Success Text

The success-text attribute provides a custom success message. Any current error state will be overridden by success-text.

Icon

The icon attribute can set to display an icon from the icon library on the component.

The preferred way to add icons is to use the icon slot.

The icon prop is deprecated (as of 05/25) and directly replaced with icon slot. icon is still functional in the component but will be removed in a future major release. This will be communicated when it's removal becomes a release candidate at the end of the support period.

Scale

The scale attribute controls the Text Field input element display size. Use condensed in situations when space is limited, for example, inside a Data Grid cell.

The reason for using scale for form elements and not size (as used in other components such as Button), is that size is a HTML attribute that can be used on input elements (and also Text Field) to control the width of the input.

Shape

The shape attribute controls the border radius of the Text Field input element.

Appearance

The appearance attribute controls the style of the Text Field input element.
Use ghost in combination with a containing element which provides a border, for example Action Group.

Disabled

The disabled attribute disables the Text Field input element.

Read Only

The readonly attribute prevents the user from changing the Text Field input element value.