UnflowUI
Components

Input

A flexible text field supporting single-line, multiline, password, and all HTML input types. Accepts icons, action elements, inline status indicators, and a clearable value.

Overview

Input wraps a native <input> (or <textarea> when multiline is set) and layers an accessible label via InputLabel, a status indicator via InputStatus, and optional icon or element slots on both sides.

The sensitive prop toggles a reveal/hide button for passwords. The onClear prop wires up a clear icon-button that appears whenever there is a value.

Import

import { Input } from '@unflowio/ui/components/Input';

Props

PropTypeDefaultDescription
namestringrequiredForm field name
labelstring—Visible label above the field
placeholderstring—Placeholder text
hintstring—Helper text below the label
type'email' | 'text' | 'number' | 'tel' | 'url' | 'search' | 'password''text'Input type
valuestring—Controlled value
disabledbooleanfalseDisables the input
readOnlyboolean—Shows a value that can be focused, selected and copied but not edited. Hides the clear button
requiredbooleanfalseMarks field as required
fullWidthbooleanfalseStretches to fill container
status'valid' | 'invalid' | 'error'—Validation state — renders an InputStatus icon
statusMessagestring—Message shown in the InputStatus tooltip
sensitivebooleanfalseAdds a reveal/hide toggle (for passwords)
sensitiveDefaultHiddenbooleantrueWhether value starts hidden
multilinebooleanfalseRenders a <textarea>
rowsnumber—Row count when multiline is true
disableResizebooleanfalseDisables textarea resize handle
startIconReactNode—Icon inside the left edge
endIconReactNode—Icon inside the right edge
startElReactNode—Element attached to the left border (e.g. URL prefix)
endElReactNode—Element attached to the right border (e.g. action button)
onClearMouseEventHandler—Wires up a clear button — rendered when value is non-empty

All standard HTMLInputElement props are forwarded.

Default

<Input
  name="demo"
  label="Label"
  placeholder="Placeholder"
  hint="This is a hint text to help user."
  value={value}
  onChange={(e) => setValue(e.currentTarget.value)}
  onClear={() => setValue('')}
/>

Textarea

<Input
  name="description"
  label="Description"
  placeholder="Write something…"
  multiline
  rows={4}
  disableResize
  value={value}
  onChange={(e) => setValue(e.currentTarget.value)}
/>

Password

<Input
  name="password"
  label="Password"
  type="password"
  placeholder="Enter your password"
  sensitive
  value={value}
  onChange={(e) => setValue(e.currentTarget.value)}
/>

Toggle visibility is wired up automatically when sensitive={true}.

With icons

import { Envelope } from '@unflowio/icons/communication/envelope';

<Input
  name="email"
  label="Email"
  type="email"
  placeholder="you@example.com"
  startIcon={<Envelope />}
  value={value}
  onChange={(e) => setValue(e.currentTarget.value)}
  onClear={() => setValue('')}
/>

Use startIcon and endIcon for decorative 16×16 icons inside the field boundary.

With action element

import { Cloud } from '@unflowio/icons/system-devices/cloud';
import { Button } from '@unflowio/ui/components/Button';

<Input
  name="demo"
  label="With action"
  placeholder="Placeholder"
  startIcon={<Cloud />}
  endEl={
    <Button
      variant="tertiary"
      label="Copy"
      type="button"
      className="rounded-none rounded-tr-md rounded-br-md"
    />
  }
  value={value}
  onChange={(e) => setValue(e.currentTarget.value)}
/>

startEl and endEl attach a full-height element to the left or right border — useful for URL prefixes, currency selectors, or action buttons.

Read-only

readOnly shows a value the person can focus, select and copy but not change. Unlike disabled, the field stays in the tab order, is submitted with forms and keeps full-contrast text; it sits on the muted surface and never shows the clear button.

<Input
  name="workspace-id"
  label="Workspace ID"
  hint="Share it with support when you open a ticket."
  value="ws_8f2k41c9"
  readOnly
/>

Status

<Input name="valid"   label="Valid"   status="valid"   statusMessage="Looks good!"          value={value} onChange={() => {}} />
<Input name="invalid" label="Invalid" status="invalid" statusMessage="Invalid format."       value={value} onChange={() => {}} />
<Input name="error"   label="Error"   status="error"   statusMessage="Something went wrong." value={value} onChange={() => {}} />

status renders an InputStatus icon at the top-right of the field. Hovering the icon shows statusMessage in a tooltip.

Customization (slotProps)

SlotPropsDescription
inputContainerHTMLDivElement propsThe input wrapper div
inputLabelOmit<IInputLabel, 'label' | 'hint' | 'required' | 'fullWidth'>The label component
clearButtonOmit<IIconButton, 'icon' | 'onClick'>The clear button
sensitiveButtonOmit<IIconButton, 'icon' | 'onClick'>The reveal/hide button
statusOmit<IInputStatus, 'status' | 'message'>The status icon
startIconHTMLSpanElement propsWrapper around startIcon
endIconHTMLSpanElement propsWrapper around endIcon
startElHTMLDivElement propsWrapper around startEl
endElHTMLDivElement propsWrapper around endEl

Accessibility

  • Label is rendered by InputLabel and linked to the input via htmlFor / id.
  • required sets both the HTML required attribute and the visual required marker on InputLabel.
  • readOnly sets the native readonly attribute, so assistive tech announces the field as read-only while it stays focusable.
  • Placeholder text uses --fg-placeholder, which reaches 4.5:1 on the field surface. A placeholder is not a label: keep a label on the field.
  • Password reveal/hide button uses aria-label to announce the current state.
  • status and statusMessage are surfaced to screen readers via the InputStatus tooltip.