Qortora · Search · Indexed page

shopify.devFetched 2026-08-17T11:50:40Z

Text field

The text field component captures single-line text input. Use it to collect short, free-form information like names, titles, or identifiers.

Open original source · Full cached text

Text fieldSkip to main content Apps Storefronts Agents References Changelog Ask assistant/ Help • Log inCollapse sidebar Polaris App Home (iframe) Overview Getting started Building your app Page patterns Direct API access Configuration Testing and deployment Resources APIs Web components App Bridge web components Page patterns Full index Text field Install AI ToolkitAsk about this pageCopy MD The text field component captures single-line text input. Use it to collect short, free-form information like names, titles, or identifiers. The component supports various input configurations including placeholders, character limits, and validation. For multi-line text entry, use text area. For specialized input types, use email field, URL field, password field, or search field. Anchor to Use casesUse cases General input: Collect titles, names, SKUs, or other short text values. Product attributes: Capture product properties like brand, model, or category. Configuration values: Input configuration settings requiring single-line text. Search queries: Provide search input fields for filtering or finding resources. Anchor to TextFieldTextField Configure the following properties on the text field component. Anchor to iconiconicon "replace" | "search" | "split" | "link" | "edit" | "info" | "incomplete" | "complete" | "product" | "variant" | "collection" | "select" | "color" | "money" | "order" | "code" | ... 542 more ... | AnyStringAnyString"replace" | "search" | "split" | "link" | "edit" | "info" | "incomplete" | "complete" | "product" | "variant" | "collection" | "select" | "color" | "money" | "order" | "code" | ... 542 more ... | AnyStringAnyString Default: ''Default: '' requiredrequired An icon displayed inside the field to provide visual context about the expected input or field purpose. Commonly used for search fields, currency inputs, or to indicate field type. Accepts any icon name from the icon library or a custom string identifier. Anchor to maxLengthmaxLengthmaxLength numbernumber Default: InfinityDefault: Infinity requiredrequired The maximum number of characters allowed in the field. Anchor to minLengthminLengthminLength numbernumber Default: 0Default: 0 requiredrequired The minimum number of characters required in the field. Anchor to prefixprefixprefix stringstring Default: ''Default: '' requiredrequired A non-editable text value displayed immediately before the editable portion of the field. This is useful for displaying an implied part of the value, such as https:// or +353. This text can't be edited by the user and is not included in the field's value. The prefix might not appear until the user interacts with the field. For example, an inline label might occupy the prefix position until the user focuses the field. Anchor to suffixsuffixsuffix stringstring Default: ''Default: '' requiredrequired A non-editable text value displayed immediately after the editable portion of the field. This is useful for displaying an implied part of the value, such as @shopify.com or %. This text can't be edited by the user and is not included in the field's value. The suffix might not appear until the user interacts with the field. For example, an inline label might occupy the suffix position until the user focuses the field. Anchor to valuevaluevalue stringstring requiredrequired The current text value in the field as a string. When setting this property programmatically, it updates the field's display value. When reading it, you get the user's current input. Anchor to autocompleteautocompleteautocomplete "on" | "off" | TextAutocompleteFieldTextAutocompleteField | `section-${string} one-time-code` | "shipping one-time-code" | "billing one-time-code" | `section-${string} shipping one-time-code` | `section-${string} billing one-time-code` | `section-${string} language` | `section-${string} organization` | `section-${string} name` | ... 141..."on" | "off" | TextAutocompleteFieldTextAutocompleteField | `section-${string} one-time-code` | "shipping one-time-code" | "billing one-time-code" | `section-${string} shipping one-time-code` | `section-${string} billing one-time-code` | `section-${string} language` | `section-${string} organization` | `section-${string} name` | ... 141... Default: 'on' for everything elseDefault: 'on' for everything else requiredrequired Controls browser autofill behavior for the field. Basic values: on - Enables autofill without specifying content type (default) off - Disables autofill for sensitive data or one-time codes Specific field values describe the expected data type. You can optionally prefix these with: section-${string} - Scopes autofill to a specific form section (when multiple forms exist on the same page) shipping or billing - Indicates whether the data is for shipping or billing purposes Both section and group (for example, section-primary shipping email) Providing a specific autofill token helps browsers suggest more relevant saved data. Learn more about the set of autocomplete values supported in browsers. Anchor to defaultValuedefaultValuedefaultValue stringstring requiredrequired The initial value of the field when it first loads. Unlike placeholder, this is a real value that the user can edit and that gets submitted with the form. Once the user starts typing, their input replaces it. Changing this property after the field has loaded has no effect. To update the field value at any time, use value instead. Anchor to detailsdetailsdetails stringstring requiredrequired Supplementary text displayed below the checkbox to provide additional context, instructions, or help. Use this to explain what checking the box means or provide guidance to users. This text is announced to screen readers. Anchor to errorerrorerror stringstring requiredrequired An error message displayed below the checkbox to indicate validation problems. When set, the checkbox is styled with error indicators and the message is announced to screen readers. Anchor to labellabellabel stringstring requiredrequired The text displayed as the field label, which identifies the purpose of the field to users. This label is associated with the field for accessibility and helps users understand what information to provide. Anchor to labelAccessibilityVisibilitylabelAccessibilityVisibilitylabelAccessibilityVisibility "visible" | "exclusive""visible" | "exclusive" Default: 'visible'Default: 'visible' requiredrequired Controls whether the label is visible to all users or only to screen readers. visible: The label is shown to everyone (default). exclusive: The label is visually hidden but still announced by screen readers. Use exclusive when the surrounding context makes the label redundant visually, but screen reader users still need it for clarity. Anchor to placeholderplaceholderplaceholder stringstring requiredrequired The placeholder text displayed in the field when it's empty, providing a hint about the expected input format or value. Anchor to readOnlyreadOnlyreadOnly booleanboolean Default: falseDefault: false requiredrequired Whether the field is read-only and can't be edited. Read-only fields remain focusable and their content is announced by screen readers. Anchor to requiredrequiredrequired booleanboolean Default: falseDefault: false requiredrequired Whether the field requires a value before form submission. Displays a visual indicator and adds semantic meaning, but doesn't automatically validate or show errors. Use the error property to display validation messages. Anchor to disableddisableddisabled booleanboolean Default: falseDefault: false requiredrequired Whether the field is disabled, preventing any user interaction. Anchor to ididid stringstring requiredrequired A unique identifier for the element. Use this to reference the element in JavaScript, link labels to form controls, or target specific elements for styling or scripting. Anchor to namenamename stringstring requiredrequired The name attribute for the field, used to identify the field's value when the form is submitted. Must be unique within the nearest containing form. AnyString A utility type that enables autocomplete for specific string literals while still accepting any string value. By intersecting `string` with an empty object type, this prevents TypeScript from widening literal types, preserving IDE suggestions for known values while maintaining flexibility for custom strings. string & {} TextAutocompleteField Represents autocomplete values that are valid for text input fields. This is a subset of `AnyAutocompleteField` containing only fields suitable for text-based inputs. Available values: - `name` - Full name - `given-name` - First name - `additional-name` - Middle name - `family-name` - Last name - `nickname` - Nickname or handle - `username` - Username for login - `honorific-prefix` - Name prefix (Mr., Mrs., Dr.) - `honorific-suffix` - Name suffix (Jr., Sr., III) - `organization` - Company or organization name - `organization-title` - Job title or position - `address-line1` - Street address (first line) - `address-line2` - Street address (second line) - `address-line3` - Street address (third line) - `address-level1` - State or province - `address-level2` - City or town - `address-level3` - District or locality - `address-level4` - Neighborhood or suburb - `street-address` - Complete street address (multi-line) - `postal-code` - Postal or ZIP code - `country` - Country code (US, CA, GB) - `country-name` - Country name (United States, Canada) - `language` - Preferred language - `sex` - Gender or sex - `one-time-code` - One-time codes for authentication - `transaction-currency` - Currency code (USD, EUR, GBP) - `cc-name` - Name on credit card - `cc-given-name` - First name on credit card - `cc-additional-name` - Middle name on credit card - `cc-family-name` - Last name on credit card - `cc-type` - Credit card type (Visa, Mastercard) 'language' | 'organization' | 'name' | 'additional-name' | 'address-level1' | 'address-level2' | 'address-level3' | 'address-level4' | 'address-line1' | 'address-line2' | 'address-line3' | 'country-name' | 'country' | 'family-name' | 'given-name' | 'honorific-prefix' | 'honorific-suffix' | 'nickname' | 'one-time-code' | 'organization-title' | 'postal-code' | 'sex' | 'street-address' | 'transaction-currency' | 'username' | 'cc-additional-name' | 'cc-family-name' | 'cc-given-name' | 'cc-name' | 'cc-type' Anchor to SlotsSlots The text field component supports slots for additional content placement within the component. Learn more about using slots. Anchor to accessoryaccessoryaccessory HTMLElementHTMLElement Additional interactive content displayed within the text field. Accepts button and clickable components with text content only. Other component types or complex layouts are not supported. Anchor to EventsEvents The text field component provides event callbacks for handling user interactions. Learn more about handling events. Anchor to blurblurblur CallbackEventListenerCallbackEventListener<'input'>CallbackEventListenerCallbackEventListener<'input'> requiredrequired A callback fired when the text field loses focus. Learn more about the blur event. Anchor to changechangechange CallbackEventListenerCallbackEventListener<'input'>CallbackEventListenerCallbackEventListener<'input'> requiredrequired A callback fired when the text field value changes. Learn more about the change event. Anchor to focusfocusfocus CallbackEventListenerCallbackEventListener<'input'>CallbackEventListenerCallbackEventListener<'input'> requiredrequired A callback fired when the text field receives focus. Learn more about the focus event. Anchor to inputinputinput CallbackEventListenerCallbackEventListener<'input'>CallbackEventListenerCallbackEventListener<'input'> requiredrequired A callback fired when the user inputs data into the text field. Learn more about the input event. CallbackEventListener A function that handles events from UI components. This type represents an event listener callback that receives a `Call…