Skip to main content

A text input component that works with Field, with optional word count and live-region announcements.

Features

Installation

typo3 ui:add input

Read more about installing Components and Primitives.

Examples

With Field

Nest ui:input.root directly inside ui:field.root - it inherits name, disabled, required, invalid and aria-describedby automatically, the same way ui:select/ui:numberInput do. Use the primitive's own label part (nested inside root) rather than field.label - it targets the right control automatically.

We'll only use this to send your confirmation.

With Word Count

Pass maxLength and add the wordCount/liveRegion parts wherever you want them - they don't need to be direct siblings of input.

0 / 140 characters

With a Transform Callback

transform runs on every native input event, before the value is committed - return the value that should actually be written back to the input, with cursor position preserved across the rewrite. Because a real function can't cross the PHP → client JSON boundary, this can only be set by constructing Input yourself in a custom entry file, rather than as a Fluid prop. Type lowercase below - it's uppercased as you type:

API Reference

The following tables cover the available props of the Fluid Primitives.

input.root

Provides shared input state and wraps all related parts. Renders a <div> element.

NameDescriptionRequiredDefault
typestring
The HTML input type attribute, e.g. text, email, password, search, tel, url.
No
'text'
placeholderstring
Placeholder text shown when the input is empty.
No
-
autocompletestring
Hints for browser autofill, e.g. email, tel, given-name, street-address. See the [HTML spec](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill) for the full list of tokens.
No
-
namestring
The name attribute of the input. Useful for form submission. Inherited from a surrounding field when available.
No
-
disabledboolean
Whether the input is disabled. Inherited from a surrounding field when available.
No
-
invalidboolean
Whether the input value is invalid. Inherited from a surrounding field when available.
No
-
requiredboolean
Whether the input is required. Inherited from a surrounding field when available.
No
-
readOnlyboolean
Whether the input is readonly. Inherited from a surrounding field when available.
No
-
defaultValuestring
The initial value of the input when rendered. Use when you don't need to control the value of the input. Inherited from a surrounding field when available.
No
''
maxLengthinteger
The maximum number of characters allowed. Also drives the wordCount part, e.g. '42 / 250 characters'.
No
-
patternstring
A regular expression the input's value is checked against on form submission.
No
-
inputModestring
Hints at the type of data that might be entered by the user and the keyboard shown on mobile devices, e.g. numeric, email, tel.
No
-
translationsarray
Specifies the localized word count string. Set the wordCount entry to false to disable the wordCount part and live-region announcements entirely. Use `f:translate` for per-template localization overrides when needed.
No
-
announceDebounceinteger
Milliseconds to debounce word count live-region announcements by, so rapid typing doesn't spam assistive tech. Set to 0 to announce every change immediately.
No
600
asChildboolean
If true the component uses its child only without the component template. Like Radix UI asChild or Base UI render props.
No
-
rootIdstring
The root ID of the component, used for hydration and identification.
No
-
idsarray
The IDs of of the component parts for composition.
No
[]
controlledboolean
If true, the component is meant to be initialized manually inside another component
No
false
classstring
The CSS class(es) to be applied to the component.
No
-
attributesarray
Additional attributes that should be rendered on the component where ui:attributes is used.
No
[]

input.label

Labels the input. Renders a <label> element.

NameDescriptionRequiredDefault
asChildboolean
If true the component uses its child only without the component template. Like Radix UI asChild or Base UI render props.
No
-
classstring
The CSS class(es) to be applied to the component.
No
-
attributesarray
Additional attributes that should be rendered on the component where ui:attributes is used.
No
[]

input.input

The editable input. Renders an <input> element.

NameDescriptionRequiredDefault
asChildboolean
If true the component uses its child only without the component template. Like Radix UI asChild or Base UI render props.
No
-
classstring
The CSS class(es) to be applied to the component.
No
-
attributesarray
Additional attributes that should be rendered on the component where ui:attributes is used.
No
[]

input.wordCount

Displays the character count, e.g. '42 / 250 characters'. Renders a <span> element.

NameDescriptionRequiredDefault
asChildboolean
If true the component uses its child only without the component template. Like Radix UI asChild or Base UI render props.
No
-
classstring
The CSS class(es) to be applied to the component.
No
-
attributesarray
Additional attributes that should be rendered on the component where ui:attributes is used.
No
[]

input.liveRegion

Announces word count updates to assistive technology. Renders a <div> element.

NameDescriptionRequiredDefault
asChildboolean
If true the component uses its child only without the component template. Like Radix UI asChild or Base UI render props.
No
-
classstring
The CSS class(es) to be applied to the component.
No
-
attributesarray
Additional attributes that should be rendered on the component where ui:attributes is used.
No
[]

Anatomy

<primitives:input.root>
    <primitives:input.label />
    <primitives:input.input />
    <primitives:input.wordCount />
    <primitives:input.liveRegion />
</primitives:input.root>