@antadesign/anta
    Preparing search index...

    Interface InputPropsUnreviewed

    Common props for JSX component wrappers.

    interface InputProps {
        children?: ReactNode;
        label?: ReactNode;
        hint?: ReactNode;
        status?: "neutral" | "brand" | "info" | "success" | "warning" | "critical";
        statusIcon?: string & {} | false | (keyof IconShapes);
        tone?: string;
        priority?: "primary" | "secondary" | "tertiary";
        size?: "small" | "medium" | "large";
        value?: string;
        defaultValue?: string;
        multiline?: boolean;
        rows?: number;
        maxRows?: number;
        clearable?: boolean;
        leading?: ReactNode;
        trailing?: ReactNode;
        type?: "text" | "search" | "email" | "password" | "tel" | "url" | "number";
        autoComplete?:
            | "off"
            | "on"
            | "name"
            | "username"
            | "email"
            | "current-password"
            | "new-password"
            | "one-time-code"
            | "tel"
            | "url"
            | string & {};
        inputMode?: | "none"
        | "text"
        | "decimal"
        | "numeric"
        | "tel"
        | "search"
        | "email"
        | "url";
        autoFocus?: boolean;
        name?: string;
        placeholder?: string;
        truncate?: boolean;
        disabled?: boolean;
        readOnly?: boolean;
        button?: boolean;
        required?: boolean;
        dimActions?: boolean;
        round?: boolean
        | number
        | string;
        spellCheck?: boolean;
        maxLength?: number;
        minLength?: number;
        pattern?: string;
        min?: number | string;
        max?: number | string;
        step?: number | string;
        onInput?: (e: any) => void;
        onChange?: (e: any) => void;
        onValueChange?: (event: any, attrs: InputChangeAttrs) => void;
        onClearClick?: (e: CustomEvent) => void;
        onClearInput?: (e: CustomEvent) => void;
        onFocus?: (e: any) => void;
        onBlur?: (e: any) => void;
        role?: string;
        className?: string;
        style?: CSSProperties;
        id?: string;
        title?: string;
        slot?: string;
        tabIndex?: number;
        key?: string | number | null;
        onClick?: (e: any) => void;
        onDoubleClick?: (e: any) => void;
        onAuxClick?: (e: any) => void;
        onContextMenu?: (e: any) => void;
        onMouseDown?: (e: any) => void;
        onMouseUp?: (e: any) => void;
        onMouseEnter?: (e: any) => void;
        onMouseLeave?: (e: any) => void;
        onMouseMove?: (e: any) => void;
        onMouseOver?: (e: any) => void;
        onMouseOut?: (e: any) => void;
        onPointerDown?: (e: any) => void;
        onPointerUp?: (e: any) => void;
        onPointerMove?: (e: any) => void;
        onPointerEnter?: (e: any) => void;
        onPointerLeave?: (e: any) => void;
        onPointerOver?: (e: any) => void;
        onPointerOut?: (e: any) => void;
        onPointerCancel?: (e: any) => void;
        onGotPointerCapture?: (e: any) => void;
        onLostPointerCapture?: (e: any) => void;
        onTouchStart?: (e: any) => void;
        onTouchEnd?: (e: any) => void;
        onTouchMove?: (e: any) => void;
        onTouchCancel?: (e: any) => void;
        onKeyDown?: (e: any) => void;
        onKeyUp?: (e: any) => void;
        onBeforeInput?: (e: any) => void;
        onInvalid?: (e: any) => void;
        onReset?: (e: any) => void;
        onSubmit?: (e: any) => void;
        onSelect?: (e: any) => void;
        onCopy?: (e: any) => void;
        onCut?: (e: any) => void;
        onPaste?: (e: any) => void;
        onCompositionStart?: (e: any) => void;
        onCompositionUpdate?: (e: any) => void;
        onCompositionEnd?: (e: any) => void;
        onDrag?: (e: any) => void;
        onDragStart?: (e: any) => void;
        onDragEnd?: (e: any) => void;
        onDragEnter?: (e: any) => void;
        onDragLeave?: (e: any) => void;
        onDragOver?: (e: any) => void;
        onDrop?: (e: any) => void;
        onScroll?: (e: any) => void;
        onWheel?: (e: any) => void;
        onAnimationStart?: (e: any) => void;
        onAnimationEnd?: (e: any) => void;
        onAnimationIteration?: (e: any) => void;
        onTransitionEnd?: (e: any) => void;
        onLoad?: (e: any) => void;
        onError?: (e: any) => void;
        onAbort?: (e: any) => void;
        onToggle?: (e: any) => void;
        onBeforeToggle?: (e: any) => void;
        onCanPlay?: (e: any) => void;
        onCanPlayThrough?: (e: any) => void;
        onDurationChange?: (e: any) => void;
        onEmptied?: (e: any) => void;
        onEnded?: (e: any) => void;
        onLoadedData?: (e: any) => void;
        onLoadedMetadata?: (e: any) => void;
        onLoadStart?: (e: any) => void;
        onPause?: (e: any) => void;
        onPlay?: (e: any) => void;
        onPlaying?: (e: any) => void;
        onProgress?: (e: any) => void;
        onRateChange?: (e: any) => void;
        onSeeked?: (e: any) => void;
        onSeeking?: (e: any) => void;
        onStalled?: (e: any) => void;
        onSuspend?: (e: any) => void;
        onTimeUpdate?: (e: any) => void;
        onVolumeChange?: (e: any) => void;
        onWaiting?: (e: any) => void;
        [key: `data-${string}`]: unknown;
        [key: `aria-${string}`]: unknown;
    }

    Hierarchy (View Summary)

    Indexable

    • [key: `data-${string}`]: unknown

      Any data-* attribute is forwarded to the rendered element.

    • [key: `aria-${string}`]: unknown

      Any aria-* attribute is forwarded to the rendered element.

    Index
    children?: ReactNode

    Extra content rendered directly under the field, above the hint/error (it pushes the message down). A no-box child like an Anta <Tooltip> takes no space and anchors to the field — consistent with how tooltips attach to any other element. Use the named leading / trailing props for in-field content.

    label?: ReactNode

    Field label, shown above the control. A string is rendered with the label type scale; pass a node for full control. Associated with the control as its accessible name (the element mirrors the label text to aria-label, since <label for> can't cross the shadow boundary).

    hint?: ReactNode

    Message below the field. Neutral helper text by default; status recolors it and prefixes the matching glyph.

    status?: "neutral" | "brand" | "info" | "success" | "warning" | "critical"

    Validation / feedback tone — colors the border + hint and prefixes a glyph. Only critical marks the field invalid (aria-invalid, blocks form submission, :state(invalid)); success / warning / info / brand are advisory and stay valid. Omit (or neutral) for a plain field.

    statusIcon?: string & {} | false | (keyof IconShapes)

    Glyph shown before the hint when status is set. Each status has a default (critical → warning-diamond, warning → warning-triangle, success → circle-check, info → info, brand → circle-small-solid); pass a shape to override, or false to drop it. neutral has no default glyph.

    tone?: string

    Custom accent color — any literal CSS color tints the border when shown (focus ring stays the global --focus-ring). For consistency with the other controls' custom-tone knob; a status still overrides for validation.

    priority?: "primary" | "secondary" | "tertiary"

    Field emphasis. primary has a fill and border, secondary keeps the border without a fill, and tertiary makes the border transparent until hover or focus. Status borders remain visible at rest.

    primary
    
    size?: "small" | "medium" | "large"

    Size variant. small=24px, medium=28px, large=32px tall; the type scale and icon track the size (small 13/16 + 14px icon · medium 15/20 + 16px · large 17/22 + 18px).

    medium
    
    value?: string

    Controlled value. Pair with onChange / onInput.

    defaultValue?: string

    Initial value for the uncontrolled case.

    multiline?: boolean

    Render a <textarea> instead of an <input>. Without rows it grows with its content from one line (capped by maxRows if set). Autogrow uses CSS field-sizing where supported (Chrome/Edge, Safari ≥ 26.2) and falls back to a built-in JS resize elsewhere (Firefox, older Safari), so it grows in every browser.

    rows?: number

    Fixed visible row count — a constant-height <textarea> (implies multiline).

    maxRows?: number

    Cap the autogrow height (in rows) of a multiline field with no rows. Omit for unbounded growth.

    clearable?: boolean

    Show a clear button as the first trailing item once the field has a value.

    leading?: ReactNode

    Content pinned to the start of the field (e.g. an icon).

    trailing?: ReactNode

    Content pinned to the end of the field (e.g. icons, buttons), after the clear button when clearable.

    type?: "text" | "search" | "email" | "password" | "tel" | "url" | "number"

    Single-line input type. Ignored when multiline. search is a wrapper-only shorthand: it defaults a leading search icon and a clear button (both overridable — pass your own leading, or clearable={false}) and sets inputmode="search", but the DOM input stays type="text". The native search type never reaches the element, so the browser's own clear/search affordances never appear — Anta owns that chrome.

    text
    
    autoComplete?:
        | "off"
        | "on"
        | "name"
        | "username"
        | "email"
        | "current-password"
        | "new-password"
        | "one-time-code"
        | "tel"
        | "url"
        | string & {}

    Native autocomplete token. Overrides the value derived from type (email / tel / url) — set it for the cases type can't express, e.g. username, current-password, new-password, one-time-code, or off.

    inputMode?:
        | "none"
        | "text"
        | "decimal"
        | "numeric"
        | "tel"
        | "search"
        | "email"
        | "url"

    Virtual-keyboard hint. Overrides the value derived from type.

    autoFocus?: boolean

    Focus this field when its containing Dialog opens.

    name?: string

    Form field name — submitted with the form via ElementInternals.

    placeholder?: string

    Placeholder shown when empty.

    truncate?: boolean

    Ellipsize an overflowing single-line value. Read-only inputs already do this; pass false when an editable field should show the full value.

    true
    
    disabled?: boolean

    Disable the field.

    readOnly?: boolean

    Make the field read-only.

    button?: boolean

    Render the field surface with a native button as its focus target. This is available for Input-styled popup triggers; the value becomes the button text and the placeholder is shown while it is empty.

    required?: boolean

    Mark the field required (drives native validity).

    dimActions?: boolean

    Dim the leading / trailing adornments at rest; they brighten to full when the field is hovered or focused (a quiet-until-engaged affordance for trailing actions).

    round?: boolean | number | string

    Fully-round the field (border-radius: 999px). Pass a number (px) or a CSS length string for a custom radius. The clearable × button always rounds to a circle to match (it isn't sized by a custom field value).

    spellCheck?: boolean

    Toggle native spell-checking.

    maxLength?: number

    Max input length.

    minLength?: number

    Min input length.

    pattern?: string

    Validation pattern (single-line).

    min?: number | string

    Min / max / step — for type="number".

    max?: number | string
    step?: number | string
    onInput?: (e: any) => void

    Fires on every keystroke. Read e.target.value.

    onChange?: (e: any) => void

    Fires on commit (blur / Enter) — the platform change semantics, not React's per-keystroke onChange. This is a web component, so onChange keeps the native meaning; reach for onInput (every keystroke) or onValueChange (both) for live updates. Read e.target.value.

    onValueChange?: (event: any, attrs: InputChangeAttrs) => void

    Unified value-change handler — the easy path for state. Fires on input and change (and on clear), with the native event plus a convenience attrs snapshot (value, name, empty, valid, validationMessage) so you can do setForm(s => ({ ...s, [attrs.name]: attrs.value })) without digging into the event. Use event.type to tell a live edit (input) from a commit (change); read id / type / className off event.target.

    onClearClick?: (e: CustomEvent) => void

    Fires when the built-in clear button (clearable) is clicked, before the field is cleared. Call e.preventDefault() to keep the current value — the clear is cancelled and onClearInput won't fire. Backed by the element's cancelable, bubbling clearclick event.

    onClearInput?: (e: CustomEvent) => void

    Fires after the built-in clear button (clearable) has cleared the field — so onInput / onChange fire too — making this useful for reacting specifically to a clear. Doesn't fire if onClearClick cancelled the clear. Backed by the element's bubbling clearinput event.

    onFocus?: (e: any) => void

    Fires when the field gains focus.

    onBlur?: (e: any) => void

    Fires when the field loses focus.

    role?: string

    ARIA role for the field — e.g. combobox when the input drives a suggestion listbox (see InputAutocomplete). The custom element delegates it, together with standard aria-* props, to the focused native shadow control. Left unset by default.

    className?: string

    CSS class on the component's root element (merged with the component's own classes). Use it directly for layout and positioning — grid/flex placement, margins, alignment — rather than wrapping the component in a <div>/<span>.

    style?: CSSProperties

    Inline styles on the component's root element. Set layout/positioning here (or via className) directly on the component instead of adding a wrapper.

    id?: string

    HTML id attribute.

    title?: string

    HTML title attribute — native browser tooltip on hover.

    slot?: string

    Assigns the element to a named <slot> of a parent web component (e.g. slot="header" inside a <Card>, slot="footer" inside a <Dialog>).

    tabIndex?: number

    Tab order. Set to -1 to skip the element when tabbing.

    key?: string | number | null

    React/Preact reconciliation key when rendered inside a list. Consumed by the JSX runtime (not forwarded as a DOM attribute).

    onClick?: (e: any) => void
    onDoubleClick?: (e: any) => void
    onAuxClick?: (e: any) => void
    onContextMenu?: (e: any) => void
    onMouseDown?: (e: any) => void
    onMouseUp?: (e: any) => void
    onMouseEnter?: (e: any) => void
    onMouseLeave?: (e: any) => void
    onMouseMove?: (e: any) => void
    onMouseOver?: (e: any) => void
    onMouseOut?: (e: any) => void
    onPointerDown?: (e: any) => void
    onPointerUp?: (e: any) => void
    onPointerMove?: (e: any) => void
    onPointerEnter?: (e: any) => void
    onPointerLeave?: (e: any) => void
    onPointerOver?: (e: any) => void
    onPointerOut?: (e: any) => void
    onPointerCancel?: (e: any) => void
    onGotPointerCapture?: (e: any) => void
    onLostPointerCapture?: (e: any) => void
    onTouchStart?: (e: any) => void
    onTouchEnd?: (e: any) => void
    onTouchMove?: (e: any) => void
    onTouchCancel?: (e: any) => void
    onKeyDown?: (e: any) => void
    onKeyUp?: (e: any) => void
    onBeforeInput?: (e: any) => void
    onInvalid?: (e: any) => void
    onReset?: (e: any) => void
    onSubmit?: (e: any) => void
    onSelect?: (e: any) => void
    onCopy?: (e: any) => void
    onCut?: (e: any) => void
    onPaste?: (e: any) => void
    onCompositionStart?: (e: any) => void
    onCompositionUpdate?: (e: any) => void
    onCompositionEnd?: (e: any) => void
    onDrag?: (e: any) => void
    onDragStart?: (e: any) => void
    onDragEnd?: (e: any) => void
    onDragEnter?: (e: any) => void
    onDragLeave?: (e: any) => void
    onDragOver?: (e: any) => void
    onDrop?: (e: any) => void
    onScroll?: (e: any) => void
    onWheel?: (e: any) => void
    onAnimationStart?: (e: any) => void
    onAnimationEnd?: (e: any) => void
    onAnimationIteration?: (e: any) => void
    onTransitionEnd?: (e: any) => void
    onLoad?: (e: any) => void
    onError?: (e: any) => void
    onAbort?: (e: any) => void
    onToggle?: (e: any) => void
    onBeforeToggle?: (e: any) => void
    onCanPlay?: (e: any) => void
    onCanPlayThrough?: (e: any) => void
    onDurationChange?: (e: any) => void
    onEmptied?: (e: any) => void
    onEnded?: (e: any) => void
    onLoadedData?: (e: any) => void
    onLoadedMetadata?: (e: any) => void
    onLoadStart?: (e: any) => void
    onPause?: (e: any) => void
    onPlay?: (e: any) => void
    onPlaying?: (e: any) => void
    onProgress?: (e: any) => void
    onRateChange?: (e: any) => void
    onSeeked?: (e: any) => void
    onSeeking?: (e: any) => void
    onStalled?: (e: any) => void
    onSuspend?: (e: any) => void
    onTimeUpdate?: (e: any) => void
    onVolumeChange?: (e: any) => void
    onWaiting?: (e: any) => void