You are viewing a PR preview for PR #1506

Agriculture Design System
Beta
Design System for the Export Service

Text input

This component allows users to enter free-form text.

View in FigmaView in StorybookView in Github
import { ... } from '@ag.ds-next/react/text-input';

Usage

Text input components can be imported via the text-input entrypoint in the @ag.ds-next/react package.

For example:

import { ... } from '@ag.ds-next/react/text-input';

Props

TextInput Props
PropTypeDescription
labelstringDescribes the purpose of the field.
autoComplete?string
autoFocus?boolean
block?booleanIf true, the field will stretch to the fill the width of its container.
disabled?boolean
hideOptionalLabel?booleanIf true, "(optional)" will never be appended to the label.
hint?stringProvides extra information about the field.
id?string
inputMode?"none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search"
invalid?booleanIf true, the invalid state will be rendered.
maxLength?number
maxWidth?"xs" | "sm" | "md" | "lg" | "xl"Default: "md"The maximum width of the field.
message?stringMessage to show when the field is invalid.
name?string
onBlur?FocusEventHandler<HTMLInputElement>
onChange?ChangeEventHandler<HTMLInputElement>
onFocus?FocusEventHandler<HTMLInputElement>
pattern?string
placeholder?string
ref?Ref<HTMLInputElement>
required?booleanIf false, "(optional)" will be appended to the label.
type?HTMLInputTypeAttributeDefault: "text"
value?string | number | readonly string[]

Source

You can view the full source code for this package on Github.