• CMSnpm version

    • Overview
    • ContentBuilder
    • InviteUserForm
    • LoginForm
    • RenewPasswordForm
  • UInpm version

    • Overview
    • Accordion
    • AlertBubble
    • AnnouncementBar
    • Avatar
    • AvatarFileInput
    • Badge
    • Button
    • ButtonGroup
    • ButtonList
    • Calendar
    • Checkbox
    • CheckboxButton
    • CheckboxInput
    • CheckboxList
    • Chip
    • ColorRadio
    • ColorRadioGroup
    • Combobox
    • DatePicker
    • DatePickerInput
    • DateRangePicker
    • DateRangePickerInput
    • DatetimePicker
    • DatetimePickerInput
    • Dialog
    • Dropdown
    • Dropzone
    • ErrorMessage
    • FileInput
    • FlashMessages
    • FormComponent
    • Icon
    • IconButton
    • ImageGallery
    • InfoBox
    • Input
    • Label
    • Layout
    • Lightbox
    • ListItem
    • Loader
    • Lozenge
    • Menu
    • Message
    • Modal
    • ✅ ModalDialog
    • ✅ ModalHeader
    • MultiCombobox
    • MultiSelect
    • Pagination
    • Paper
    • Popover
    • Radio
    • RadioGroup
    • RasterImage
    • Select
    • ✅ Tabs
    • TextInput
    • TextLink
    • Textarea
    • TimePicker
    • TimePickerInput
    • Toggle
    • Tooltip
    • Typography
  • Formnpm version

    • Overview
    • AvatarFileInput
    • CheckboxButton
    • CheckboxInput
    • CheckboxList
    • ColorRadioGroup
    • Combobox
    • DatePickerInput
    • DateRangePickerInput
    • DatetimePickerInput
    • Dropzone
    • FileInput
    • Form
    • FormRenderer
    • GpsInput
    • MoneyInput
    • MultiCombobox
    • MultiSelect
    • NumberInput
    • PasswordInput
    • RadioGroup
    • Select
    • TextInput
    • Textarea
    • TimePickerInput
    • Toggle
  • DataGridnpm version

    • Overview
    • DataGrid
    • DataGridCustomExample
    • ExportButton
    • FilterList
    • Filters
    • FiltersButton
    • FulltextInput
    • HiddenColumns
    • HiddenColumnsButton
    • Pagination
    • RowCounts
    • RowsPerPageSelect
    • SelectedRowsToolbar
    • TableV2
    • ToolbarControl
    • ToolbarCustoms
    • ToolbarTabs
  • Wysiwygnpm version

    • Overview
  • Resizernpm version

    • Overview
  • Routernpm version

    • Overview
  • Corenpm version

    • Overview
  • Core-Reactnpm version

    • Overview
  • Stylesnpm version

    • Overview
  • Localizenpm version

    • Overview
  • Analyticsnpm version

    • Overview
  • Datepickernpm version

    • Overview
  • Icons-generatornpm version

    • Overview
  • Smart-addressnpm version

    • Overview
  • E2Enpm version

    • Overview
  • E2E-Playwrightnpm version

    • Overview
View source on GitLab

TextInput

A complete, controlled single-line text field: label, the input (with optional addons/inline elements), and helper/error text, wired together via FormComponent. Built on the Input primitive.

When to use

Use @uxf/form/text-input inside a @uxf/form form — it wires up react-hook-form (registers the field, runs required/email/phone/url validation, and reads the form context). For a standalone, controlled text field outside a form, use @uxf/ui/text-input.

For full control over the field's internal layout, drop down to the Input primitive.

Usage

import { TextInput } from "@uxf/ui/text-input";
import { useState } from "react";

function Example() {
    const [value, setValue] = useState("");

    return (
        <TextInput
            helperText="Helper text"
            label="Website"
            leftAddon="https://"
            name="website"
            onChange={setValue}
            placeholder="Some beautiful placeholder..."
            rightAddon=".cz"
            value={value}
        />
    );
}

onChange receives the new value first, then the change event: (value: string, event?) => void.

Props

Extends FormControlProps<string> and picks size / variant from Input.

Prop Type Default Description
value * string — Current value.
onChange * (value: string, event?) => void — Called with the new value.
name * string — Field name.
label ReactNode — Label text (rendered above the field).
hiddenLabel boolean false Visually hides the label (kept for screen readers).
helperText ReactNode — Helper/error text below the field. Styled as an error when isInvalid.
placeholder string — Placeholder text.
type "email" | "number" | "password" | "search" | "tel" | "text" | "url" | "time" — Native input type.
leftAddon / rightAddon ReactNode — Content attached outside the field border.
leftElement / rightElement ReactNode — Content rendered inside the field.
isInvalid boolean false Invalid state (error styling, aria-invalid, links aria-describedby to the helper text).
isDisabled boolean false Disabled state.
isReadOnly boolean false Read-only state.
isRequired boolean false Marks the field required (label marker).
isFocused boolean — Forces the focused visual state.
size InputGroupSize "default" "small", "default", or "large".
variant InputGroupVariant "default" Input group variant.
autoComplete string — Native autocomplete.
autoFocus boolean false Focus on mount.
enterKeyHint "enter" | "done" | "go" | "next" | "previous" | "search" | "send" — Virtual keyboard enter-key hint.
inputMode "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" — Virtual keyboard hint.
id, form string — Native attributes. id is auto-generated if omitted.
maxLength, minLength number — For text-like types.
min, max, step, pattern number | string — For type="number".
onBlur, onFocus FocusEventHandler<HTMLInputElement> — Focus handlers.
onKeyDown, onPaste, onBeforeInput event handler — Native events.
className string — Extra class on the root element.
style CSSProperties — Inline style on the input wrapper.

* required

The forwarded ref points to the underlying <input>.

Variants & states

Group Values
variant default
size small, default, large

Behavioural states are set via isInvalid, isDisabled, isReadOnly, isRequired, and isFocused.

Requirements

Import the component stylesheets once in your global CSS:

@import url("@uxf/ui/css/input-basic.css");
@import url("@uxf/ui/css/input.css");
@import url("@uxf/ui/css/form-component.css");
@import url("@uxf/ui/css/label.css");

Also requires the global @uxf/ui token layer, set up once per app — see @uxf/ui setup.

If an addon or inline element renders an Icon, also import @uxf/ui/css/icon.css.

Default
Open in new tab
OnlyForE2ETests
Open in new tab