Text input

The single-line field every form is built from, with its own label, message and counter, in four content shapes.

Refined portVue source: WildTextInput.vueReact component: WTextInput

Try it

Type, tab and paste into it. Paste a full address into website and the https:// comes off.

Use a name your team will recognise.
Type
Size
Icon
Clear button
Counter
Error
Read-only
Disabled
<WildTextInput
  v-model="siteName"
  size="sm"
  label="Site name"
  help="Use a name your team will recognise."
  clearable
>
  <template #leading>
    <MapPinIcon />
  </template>
</WildTextInput>

When to use

  • Use it for one line of free text.
  • Use a type for websites, amounts and counts.
Don’t use it

Anatomy

A label, the frame and a message line. Inside the frame: an optional icon, the value and a clear button once there’s a value.

Keep it short
Use a name your team will recognise.
Up to 40 characters.

Types

Four content shapes, each with a plain model.

Use a name your team will recognise.
Paste a full address or just the domain.
Dollars, with or without cents.
Between 1 and 50.
Website drops a pasted protocol. Currency stores 1250 and shows 1,250.00 once you leave. Quantity is a spinbutton with steppers.

Icon, clear and counter

Three opt-in additions. The icon is for the basic type only.

Escape clears it too.
Up to 40 characters.
Up to 12 characters.
Typing past the limit is allowed. The count turns red and the field is invalid until it fits, so a paste is never cut short.

Sizes

Use sm, at 36px, by default. Use lg, at 44px, where a field needs a bigger touch target.

sm · 36
lg · 44

States

empty
filled
hover
focus
error
error, focused
read-only
disabled
An invalid field ignores hover. Focused, it keeps the red edge and adds the focus ring outside it. Read-only stays in the tab order.

In context

Press Add site with the name empty. The error shows and focus moves to the field.

Add a site
Only the name is required.
Up to 40 characters.
Optional
Add it now or later.

Inside a form field

Where a Form field already gives the label, help and error, use the bare box, WInput. It takes the same sizes, types and states.

Site name*
e.g. Bore 12
<WildFormField label="Site name" required>
  <WildTextInput placeholder="e.g. Bore 12" />
</WildFormField>

Content

  • Write labels as short nouns: Site name, Monthly budget.
  • Use the placeholder for an example value, never as the label.
  • Write the error as the fix: Enter a site name.

Accessibility

Help, error and limit are read with the input. The count is announced when typing pauses.

KeyWhat it does
TabInto the field, then to the clear button.
EscapeClears a clearable field.
↑ / ↓Quantity: one step.
Page Up / Page DownQuantity: ten steps.
Home / EndQuantity: minimum or maximum.

Props

PropTypeDefaultDescription
v-modelstring—The value, as a plain string.
type'basic' | 'website' | 'currency' | 'quantity''basic'See Types.
size'sm' | 'lg''sm'36px or 44px.
labelstring—The visible name.
hintstring—Short context, right of the label.
helpstring—Guidance under the field.
errorboolean | stringfalseA string is also the message.
requiredbooleanfalseAsterisk on the label, and aria-required.
placeholderstring—An example value.
aria-labelstring—Names a field with no visible label.
readonlybooleanfalseSelectable but not editable.
disabledbooleanfalseFlat grey, out of the tab order.
clearablebooleanfalseClear button once filled.
maxlengthnumber—A soft limit with a counter.
suffixstring—Trailing unit or currency code.
website-prefix / currency-symbolstring'https://' / '$'Website and currency prefixes.
min / max / stepnumber0 / — / 1Quantity bounds and step.
#leadingslot—Icon ahead of the text.
@clear() => void—After a clear.

Tokens

TokenValueWhere it lands
--global-neutral-grey-600#DCDCDEResting border, 1px.
--global-neutral-grey-800#ADACB0Hover border.
--global-blue-1000#1877F2Focus edge and halo, caret.
--color-error#E12121Error edge, message, over-limit count.
--global-neutral-grey-1100#2D2B32Value text.
--global-neutral-grey-900#7F7D83Icon, clear ×, disabled text.
--global-neutral-grey-1000#4F4D55Label, placeholder, helper, units, counter.
--global-neutral-grey-200#F5F5F5Disabled ground, lighter than hover.
--global-neutral-grey-500#E6E6E6Disabled and read-only border.
--radius-lg8pxThe frame.