• CMSnpm version

    • Overview
    • ContentBuilder
    • InviteUserForm
    • LoginForm
    • RenewPasswordForm
    • WysiwygInput
  • 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
    • Switch
    • ✅ 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
  • DnDnpm 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

Input

Low-level, controlled input group primitive. Input renders the styled wrapper (border, focus/invalid/disabled states, addons and inline elements); the actual <input> is rendered by the Input.Element child.

When to use

Reach for Input when you need to compose a custom text control layout — combining the field with addons, inline icons, remove buttons, etc. — outside the higher-level fields.

  • For a ready-made labelled field with helper/error text, use TextInput (or @uxf/form/text-input inside a form). TextInput is built on top of this primitive.
  • Input is a composition primitive: it inspects its children by displayName and only renders the recognised parts (Input.Element, Input.LeftAddon, Input.RightAddon, Input.LeftElement, Input.RightElement). It does not render a <label> or error message.

There is no @uxf/form twin.

Usage

import { Input } from "@uxf/ui/input";
import { useState } from "react";

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

    return (
        <Input>
            <Input.LeftAddon>https://</Input.LeftAddon>
            <Input.Element name="website" onChange={setValue} placeholder="Placeholder" value={value} />
            <Input.RightAddon>.uxf.cz</Input.RightAddon>
        </Input>
    );
}

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

Exports

Import from @uxf/ui/input.

ExportKindDescription
InputcomponentThe input group wrapper.
Input.ElementcomponentThe <input> itself (InputElement).
Input.LeftAddon / Input.RightAddoncomponentContent attached outside the field border.
Input.LeftElement / Input.RightElementcomponentContent rendered inside the field, next to the input.
Input.RemoveButtoncomponentA clear button that calls onChange(null).
Input.ArrowIconcomponentA caret icon that rotates when isOpen.
InputProps, InputElementProps, InputRemoveButtonProps, InputGroupSize, InputGroupVarianttypes—

Props

Input (InputProps)

PropTypeDefaultDescription
children *ReactNode—Must contain the Input.* parts; only recognised displayNames are rendered.
variantInputGroupVariant"default"Visual style (see Variants & states).
sizeInputGroupSize"default""small", "default", or "large".
isFocusedbooleanfalseForces the focused visual state.
isInvalidbooleanfalseForces the invalid visual state.
isDisabledbooleanfalseForces the disabled visual state.
isReadOnlybooleanfalseForces the read-only visual state.
inputFocusReturnType<typeof useInputFocus>—Shares focus state with a parent (used by TextInput).
customInputElementDisplayNamestring"UxfUiInputElement"displayName treated as the main input, to swap in a custom element.
classNamestring—Extra class on the group.
styleCSSProperties—Inline style on the group.
inputWrapperRefRef<HTMLDivElement>—Ref to the inner wrapper <div>.
inputGroupRefRef<HTMLDivElement>—Ref to the outer group <div>.
tabIndexnumber—tabIndex on the wrapper.

The forwarded ref points to the underlying <input>. The group's focus/invalid/disabled/read-only classes are applied if the prop is set on either Input or Input.Element.

Input.Element (InputElementProps)

Extends FormControlProps<string>, so it is fully controlled.

PropTypeDefaultDescription
value *string—Current value.
onChange *(value: string, event?) => void—Called with the new value.
name *string—Input name.
type"email" | "number" | "password" | "search" | "tel" | "text" | "url" | "time"—Native input type.
placeholderstring—Placeholder text.
isDisabledbooleanfalseDisables the input.
isReadOnlybooleanfalseMakes the input read-only (also sets tabIndex={-1}).
isInvalidbooleanfalseSets aria-invalid.
autoCompletestring—Native autocomplete.
autoFocusbooleanfalseFocus on mount.
inputMode"none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search"—Virtual keyboard hint.
id, formstring—Native attributes.
maxLength, minLengthnumber—For text-like types.
min, max, step, patternnumber | string—For type="number".
onBlur, onFocusFocusEventHandler—Focus handlers.
onKeyDown, onPaste, onBeforeInputevent handler—Native events.
aria-describedby, aria-invalid——Forwarded ARIA attributes.
styleCSSProperties—Inline style on the <input>.

* required

Other parts

  • Input.LeftAddon / Input.RightAddon — { children: ReactNode }. When children is a string, a --text modifier class is added.
  • Input.LeftElement / Input.RightElement — { children?: ReactNode }.
  • Input.RemoveButton — { onChange?: (value: Value | null) => void }. Renders a clear button that calls onChange(null) on click / Enter / Space.
  • Input.ArrowIcon — { isOpen: boolean; iconName?: IconName }. Defaults to the caretDown icon and adds an "open" class when isOpen.

Variants & states

GroupValues
variantdefault
sizesmall, default, large

InputGroupVariants / InputGroupSizes are open interfaces; a project can add values via module augmentation of @uxf/ui/input/theme (matching CSS required).

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");

If you render Input.RemoveButton or Input.ArrowIcon, also import the icon stylesheet:

@import url("@uxf/ui/css/icon.css");

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

ComponentStructure
Open in new tab
Default
Open in new tab
Sizes
Open in new tab