Tuimorphic

Input

Terminal-style text input with custom blinking caret and arrow key navigation.

Import

import { Input } from 'tuimorphic';

Basic Usage

<Input placeholder="Enter text..." />

Props

PropTypeDefaultDescription
caretCharsstring' 'Custom caret character(s) to display
labelstringLabel text for the input
isBlinkbooleantrueWhether the caret should blink
typestring'text'Input type (text, password, email, number, etc.)
valuestringControlled input value
defaultValuestringDefault value for uncontrolled input
placeholderstringPlaceholder text
disabledbooleanfalseWhether the input is disabled
readOnlybooleanfalseWhether the input is read-only
onChange(event: ChangeEvent) => voidChange event handler
onFocus(event: FocusEvent) => voidFocus event handler
onBlur(event: FocusEvent) => voidBlur event handler
classNamestringAdditional CSS class names
refReact.Ref<HTMLInputElement>Forwarded ref to the input element

All standard HTML input attributes are also supported.

With Label

<Input label="Username" placeholder="Enter username" />

Password Input

Password inputs automatically mask the text with bullet characters:

<Input type="password" label="Password" placeholder="Enter password" />

With Placeholder

Enter your email...
<Input placeholder="Enter your email..." />

Disabled State

Cannot edit
<Input label="Disabled Input" disabled defaultValue="Cannot edit" />

Custom Caret

Customize the caret character for different visual styles:

<Input label="Default caret" placeholder="Type here..." />
<Input label="Block caret" caretChars="█" placeholder="Type here..." />
<Input label="Underscore caret" caretChars="_" placeholder="Type here..." />
<Input label="Pipe caret" caretChars="|" placeholder="Type here..." />

Caret Blinking

Control whether the caret blinks:

<Input label="Blinking caret (default)" placeholder="Type here..." />
<Input label="Static caret" isBlink={false} placeholder="Type here..." />

Input Types

<Input type="text" label="Text" placeholder="Regular text" />
<Input type="email" label="Email" placeholder="user@example.com" />
<Input type="password" label="Password" placeholder="Enter password" />
<Input type="number" label="Number" placeholder="Enter number" />
<Input type="tel" label="Phone" placeholder="+1 (555) 000-0000" />
<Input type="url" label="URL" placeholder="https://example.com" />

Interactive Example

Type something...
Current value: (empty)
const [value, setValue] = useState('');
 
<Input
  label="Interactive Input"
  value={value}
  onChange={(e) => setValue(e.target.value)}
  placeholder="Type something..."
/>

Features

  • Custom blinking caret: Terminal-style caret that blinks at the cursor position
  • Arrow key navigation: Press Up/Down arrows to navigate between inputs
  • Password masking: Passwords are displayed as bullet characters
  • Controlled/uncontrolled: Works both as controlled and uncontrolled component

Keyboard Navigation

KeyAction
Arrow UpFocus previous focusable element
Arrow DownFocus next focusable element
Arrow Left/RightMove caret within input

Accessibility

  • Semantic <input> element with proper labeling
  • Supports all standard input attributes
  • Keyboard accessible with visible focus states
  • Works with screen readers

Styling

VariableDescription
--theme-borderInput border color
--theme-backgroundInput background color
--theme-textInput text color
--theme-focused-borderBorder color when focused

On this page