Playground

States

Empty (label as placeholder), filled (label floats up), error, info, and disabled. Focus a field to see the label float and the focus ring.

Messages

Pass error for a critical message and red border, or info for neutral helper text. Error takes precedence over info.

On dark surface

Pass onDark when the field sits on a bold or dark surface — it uses the on-dark token variants for the right contrast.

When to Use

Best for

  • Collecting short, free-form text — names, emails, search terms
  • Form fields that benefit from a persistent label after filling
  • Fields that need inline validation or helper text

Consider alternatives when

  • Choosing from a fixed set of options — use a select, radio, or checkbox
  • Entering long, multi-line text — use a textarea
  • Entering a card number or phone — use the dedicated Card / Phone input

Props

PropTypeRequiredDescription
labelstringYesField label — doubles as the floating placeholder
valuestringNoValue (controlled). Pair with onChange
defaultValuestringNoInitial value (uncontrolled)
onChange(value: string) => voidNoChange handler — receives the next value
leftIconFC<SVGProps>NoSVGR icon component shown before the value
errorstring | booleanNoError message (string) or error border only (true)
infostringNoHelper message (hidden while an error is shown)
isDisabledbooleanNoDisable the field (default: false)
onDarkbooleanNoUse on-dark token variants for dark surfaces (default: false)
typestringNoHTML input type (default: "text")
namestringNoForm field name
idstringNoElement id (autogenerated when omitted)

Import

import { TextInput } from '@/components/TextInput/eshop';

Wrap the input (or any ancestor) in <div data-platform="eshop"> so the eShop typography classes apply.

Design Tokens

PurposeToken
Field fillvar(--color-fill-element-field)
Border (default)var(--color-border-element-field)
Border (focused)var(--color-border-element-field-focused)
Border (error)var(--color-border-element-field-error)
Value textvar(--color-content-primary)
Placeholder labelvar(--color-content-secondary)
Floated labelvar(--color-content-tertiary)
Error messagevar(--color-content-critical)
Disabled contentvar(--color-content-disabled)
Focus ringvar(--color-border-element-focus-ring)
On-dark variantsvar(--color-*-on-dark-*)
Radiusvar(--primitive-radius-12)
Typography (value / label).body-lg / .body-sm (scoped to [data-platform="eshop"])
Page tokens