Input

A single-line native text field with IME, selection and undo/redo.

Input rendered by Tarve Input rendered by Tarve
Native render. The live version loads when this comes into view.

Import

import { Input } from "@tarve/core";

Usage

Input.tsx
import { Input } from "@tarve/core";

let email = "";

<Input
  type="email"
  value={email}
  placeholder="you@example.com"
  onChange={(value) => {
    email = value;
  }}
  onSubmit={(value) => console.log("submitted", value)}
/>

Props

PropTypeDefault
autoFocus

Focus the field when it first appears (HTML `autofocus`), e.g. in a dialog that just opened.

boolean—
disabled boolean—
glass

A Liquid Glass capsule field.

GlassProp—
maxLength

The most characters the user can bring the value to (HTML `maxlength`): typing past it is dropped, a paste is cut to fit.

number—
onChange (value: string) => void—
onSubmit

Enter (with or without modifiers) submits the current value.

(value: string) => void—
placeholder string—
readOnly

Focusable, selectable and copyable, but the user cannot edit it (HTML `readonly`). The app can still change `value`.

boolean—
type InputType"text"
value string—

Common props

Shared by every component. See descriptions →

childrenclassclassNamehighlightidkeymotionFromonHighlightonPasteonPointerLeaveonPointerMoveonSizeonTransitionEndrovingGroupstyle

Types

GlassProp
type GlassProp = boolean | GlassVariant | GlassOptions;
InputType
type InputType = "text" | "password" | "email" | "number" | "search" | "tel" | "url";