TextFieldHandle interface

Module @runic-artifex/svelte in @runic-artifex/svelte 0.23.0

interface TextFieldHandle

A text input bound to one View member.

Properties

value

value: string;

What the input shows: the draft while one exists, otherwise the member's value in the View's state. Setting it is an input by the user, as bind:value does.

editing

readonly editing: boolean;

True while a draft exists, from the first input until the last write settled and the state caught up, and after a failed write. Keep the input enabled while it is true, rather than disabling it on the View's busy state, which the field's own write causes.

error

readonly error: unknown;

Why the latest write failed, until the next input or reset().

Methods

compositionStart

compositionStart(): void;

An IME composition started: the text is kept but not written until it ends. Use it as oncompositionstart.

compositionEnd

compositionEnd(event: Event | string): void;

The IME composition ended: pass the compositionend event, or the text, which is then written.

reset

reset(): void;

Drops the draft and the error and shows the View's value. Writes in flight still complete.