React

Text Field Input

A component for entering single-line text.

Available since@seed-design/react@1.1.0, @seed-design/css@1.1.0

Installation

npx @seed-design/cli@latest add ui:text-field

Props

TextField

Prop

Type

label?React.ReactNode
indicator?React.ReactNode
prefixIcon?React.ReactNode
prefix?React.ReactNode
suffixIcon?React.ReactNode
suffix?React.ReactNode
description?React.ReactNode
errorMessage?React.ReactNode
hideCharacterCount?boolean | undefined
maxGraphemeCount?number | undefined
showRequiredIndicator?boolean | undefined
fieldRef?React.Ref<HTMLDivElement> | undefined
onValueChange?((values: { value: string; graphemes: string[]; slicedValue: string; slicedGraphemes: string[]; }) => void) | undefined
value?string | undefined
defaultValue?string | undefined
name?string | undefined

TextFieldInput

Prop

Type

Examples

State

Enabled

Disabled

Read Only

Size

Use size to set the TextField's size. (default: large)

responsive automatically switches the size based on screen width. Use size=responsive to support multiple screen widths in products that need to support various screen sizes.

Customizable Parts

When conveying context with icons alone, be careful. Include text in description or label that clearly explains the icon's meaning, or configure the icon to be read by screen readers and provide an aria-label.

Prefix

Suffix

Both Affixes

Indicator

You can use either the indicator or showRequiredIndicator prop.

Grapheme Count

Information about the value split by grapheme units is provided in the onValueChange callback as graphemes and slicedGraphemes.

Grapheme segmentation is performed through unicode-segmenter.

Use Cases

Form (Uncontrolled)

React Hook Form

Number Formatting

Slicing

Table of contents