Verwendung

React to a change outside the UI

Dieser Typ wird verwendet von TextField

tsx
import { TextField, signal, watch } from 'kuito';

export function Search(props: { search: (query: string) => void }) {
  const query = signal('');
  watch(query, (text) => {
    const timer = setTimeout(() => props.search(text), 250);
    return () => clearTimeout(timer);
  });
  return <TextField label="Search" value={query} />;
}

Typdeklaration

ts
export interface TextFieldProps extends CommonProps, TextFieldNativeProps {
  /**
   * The text the field shows for what the user typed: a card number's
   * groups, a date's slashes. The caret stays after the character it
   * followed. Runs on the UI thread, before the frame, when it can
   * (docs/keyboard.md#formatting).
   */
  format?: (text: string) => string;
  /** The text, as the user changes it. */
  onChange?: (text: string) => void;
  /** The selected range, as the user moves the caret or selects. */
  onSelectionChange?: (selection: TextSelection) => void;
  onSubmit?: (event: SubmitEvent) => void;
  onFocus?: (event: FocusEvent) => void;
  onBlur?: (event: FocusEvent) => void;
}

Mitglieder 107

NameTypErforderlichBeschreibung
format(text: string) => stringNeinThe text the field shows for what the user typed: a card number's groups, a date's slashes. The caret stays after the character it followed. Runs on the UI thread, before the frame, when it can (docs/keyboard.md#formatting).
onChange(text: string) => voidNeinThe text, as the user changes it.
onSelectionChange(selection: TextSelection) => voidNeinThe selected range, as the user moves the caret or selects.
onSubmit(event: SubmitEvent) => voidNein—
onFocus(event: FocusEvent) => voidNein—
onBlur(event: FocusEvent) => voidNein—
idstringNein—
refElementRef<ElementHandle>Nein—
classProp<ClassNames>NeinClass names from a .css import or styles(): a string, or a list with falsy entries skipped, following the signals it reads.
styleStyleDeclarationsNeinStyles of this view alone, compiled at build time: CSS properties in camelCase. A value that changes must set a native prop (opacity).
onPress(event: PressEvent) => voidNein—
onPressCapture(event: PressEvent) => voidNein—
keystring | numberNein—
hiddenProp<boolean>NeinTakes the view out of layout and off screen, as CSS display: none.
paddingProp<LengthPercentage>Nein—
paddingTopProp<LengthPercentage>Nein—
paddingRightProp<LengthPercentage>Nein—
paddingBottomProp<LengthPercentage>Nein—
paddingLeftProp<LengthPercentage>Nein—
widthAnimatable<SizeValue>Nein—
heightAnimatable<SizeValue>Nein—
minWidthProp<SizeValue>Nein—
maxWidthProp<SizeValue>Nein—
minHeightProp<SizeValue>Nein—
maxHeightProp<SizeValue>Nein—
aspectRatioProp<number>NeinWidth divided by height; sizes the missing side from the other.
positionProp<"relative" | "absolute">Nein—
topProp<LengthPercentageAuto>Nein—
rightProp<LengthPercentageAuto>Nein—
bottomProp<LengthPercentageAuto>Nein—
leftProp<LengthPercentageAuto>Nein—
marginProp<LengthPercentageAuto>Nein—
marginTopProp<LengthPercentageAuto>Nein—
marginRightProp<LengthPercentageAuto>Nein—
marginBottomProp<LengthPercentageAuto>Nein—
marginLeftProp<LengthPercentageAuto>Nein—
flexGrowProp<number>Nein—
flexShrinkProp<number>Nein—
flexBasisProp<SizeValue | "content">Nein—
flexProp<number>NeinA grow factor from a zero basis, as CSS flex: n; 0 is inflexible.
alignSelfProp<"auto" | SelfAlignment>Nein—
directionProp<"ltr" | "rtl">NeinThe way lines run; unset, the parent's, and the app's first language's at the root.
boxSizingProp<"border-box" | "content-box">Nein—
paddingInlineStartProp<LengthPercentage>NeinPadding on the side lines start from: the left in ltr, the right in rtl.
paddingInlineEndProp<LengthPercentage>NeinPadding on the side lines end at: the right in ltr, the left in rtl.
marginInlineStartProp<LengthPercentageAuto>NeinMargin on the side lines start from: the left in ltr, the right in rtl.
marginInlineEndProp<LengthPercentageAuto>NeinMargin on the side lines end at: the right in ltr, the left in rtl.
insetInlineStartProp<LengthPercentageAuto>Neinleft in ltr, right in rtl.
insetInlineEndProp<LengthPercentageAuto>Neinright in ltr, left in rtl.
roleProp<Role>Nein—
onAction(event: AccessibilityActionEvent) => voidNeinThe screen reader action taken, by name.
accessibleProp<boolean>NeinMakes the view one screen reader element, read as its label or its children's text.
labelProp<string>NeinWhat a screen reader says for the view.
hintProp<string>NeinWhat happens when the view is activated, read after the label.
aria-hiddenProp<boolean>NeinScreen readers skip the view and its subtree.
actionsProp<readonly AccessibilityAction[]>NeinActions a screen reader offers; onAction receives the one taken.
liveProp<"off" | "polite" | "assertive">NeinARIA's aria-live: announces changes to the view's content, on iOS too.
aria-disabledProp<boolean>Nein—
aria-selectedProp<boolean>Nein—
aria-checkedProp<boolean | "mixed">Nein—
aria-busyProp<boolean>Nein—
aria-expandedProp<boolean>Nein—
aria-valueminProp<number>Nein—
aria-valuemaxProp<number>Nein—
aria-valuenowProp<number>Nein—
aria-valuetextProp<string>Nein—
gesturesreadonly Composable[]NeinThe view's gestures; several race unless composed with together or orElse.
opacityAnimatable<number>Nein—
backgroundColorAnimatable<string>Nein—
translateXAnimatable<number>Nein—
translateYAnimatable<number>Nein—
scaleAnimatable<number>Nein—
scaleXAnimatable<number>Nein—
scaleYAnimatable<number>Nein—
rotateAnimatable<number>NeinDegrees.
transitionPartial<Record<"opacity" | "backgroundColor" | "transform" | "borderRadius" | "borderColor" | "shadow" | "width" | "height" | "all", Animation<unknown> | AnimationSpec>>NeinHow the animatable props move when they change, enter or leave, by group; a CSS transition compiles to it.
animatePartial<Record<AnimatableProps, string | number>>NeinAnimatable props whose every change moves as transition says; the first value applies at once.
enterEffectNeinWhere the view enters from: fade.and(slide.up(12)).
exitProp<Effect>NeinWhere the view leaves to; it stays on screen until it is there. The renderer gets true, and keeps the view until exited.
layoutAnimation<number>NeinHow the view moves to a new frame the layout gives it: layout={spring()}.
borderRadiusAnimatable<number>Nein—
overflowProp<"visible" | "hidden" | "clip" | "scroll">Neinhidden and scroll clip; as in CSS, either lets a flex item shrink below its content.
borderWidthProp<number>Nein—
borderColorAnimatable<string>Nein—
shadowColorAnimatable<string>Nein—
shadowRadiusAnimatable<number>Nein—
shadowOffsetXAnimatable<number>Nein—
shadowOffsetYAnimatable<number>Nein—
backgroundGradient{ angle: number; colors: string[];}Nein—
colorProp<string>Nein—
sharedIdProp<string>NeinA view the navigation stack flies to the view with the same sharedId on the screen it pushes or pops to (docs/navigation.md#shared-elements).
valueBound<string>NeinThe field's text, as HTML's value.
disabledProp<boolean>NeinTakes no presses or input, as HTML disabled.
placeholderProp<string>Nein—
placeholderColorProp<string>NeinThe placeholder's color.
selectionColorProp<string>NeinThe cursor and selection color.
enterKeyHintProp<"enter" | "done" | "go" | "next" | "search" | "send">NeinHTML's enterkeyhint: the enter key's label. next moves focus to the next input natively.
submitBehaviorProp<"submit" | "blurAndSubmit" | "newline">NeinWhat the enter key does: newline (default with lines) adds a line; after onSubmit, blurAndSubmit (default without) hides the keyboard, or moves to the next input with enterKeyHint next, and submit keeps the focus.
autoFocusProp<boolean>NeinFocuses the input once it is on screen.
typeProp<"number" | "search" | "text" | "password" | "email" | "tel" | "url">NeinHTML's input type: the keyboard, and password hides the text.
inputModeProp<InputMode>NeinHTML's inputmode: the keyboard to show instead of the type's; none shows none.
autoCompleteProp<"off" | "email" | "tel" | "username" | "current-password" | "new-password" | "one-time-code" | "name" | "given-name" | "family-name" | "street-address" | "postal-code" | "country-name" | "cc-number">NeinHTML's autocomplete: what the field holds, for autofill and the password manager.
autoCapitalizeProp<"none" | "sentences" | "words" | "characters">NeinHTML's autocapitalize. Unset, sentences for text and search fields and none for the others.
maxLengthProp<number>NeinHTML's maxlength: the most UTF-16 code units the user can enter. Text the app sets is not cut.
spellCheckProp<boolean>NeinHTML's spellcheck, which also turns autocorrection on or off. Unset, on for text and search fields.
linesProp<number | { min?: number; max?: number;}>NeinWraps the text over lines: a count sets the height, { min, max } grows with the text (1 and no limit by default). Adding or removing it remounts the field.
selectionBound<TextSelection>NeinThe selected range, { start, end } in UTF-16 offsets as HTML's selectionStart and selectionEnd; start === end is the caret. Two-way when given a signal; unset, the caret goes to the end.
format — Methodensignaturen

Signaturen

ts
(text: string): string

Parameter

NameTypErforderlichBeschreibung
textstringJa—

Rückgabe

string

onChange — Methodensignaturen

Signaturen

ts
(text: string): void

Parameter

NameTypErforderlichBeschreibung
textstringJa—

Rückgabe

void

onSelectionChange — Methodensignaturen

Signaturen

ts
(selection: TextSelection): void

Parameter

NameTypErforderlichBeschreibung
selectionTextSelectionJa—

Rückgabe

void

onSubmit — Methodensignaturen

Signaturen

ts
(event: SubmitEvent): void

Parameter

NameTypErforderlichBeschreibung
eventSubmitEventJa—

Rückgabe

void

onFocus — Methodensignaturen

Signaturen

ts
(event: FocusEvent): void

Parameter

NameTypErforderlichBeschreibung
eventFocusEventJa—

Rückgabe

void

onBlur — Methodensignaturen

Signaturen

ts
(event: FocusEvent): void

Parameter

NameTypErforderlichBeschreibung
eventFocusEventJa—

Rückgabe

void

onPress — Methodensignaturen

Signaturen

ts
(event: PressEvent): void

Parameter

NameTypErforderlichBeschreibung
eventPressEventJa—

Rückgabe

void

onPressCapture — Methodensignaturen

Signaturen

ts
(event: PressEvent): void

Parameter

NameTypErforderlichBeschreibung
eventPressEventJa—

Rückgabe

void

onAction — Methodensignaturen

Signaturen

ts
(event: AccessibilityActionEvent): void

Parameter

NameTypErforderlichBeschreibung
eventAccessibilityActionEventJa—

Rückgabe

void

backgroundGradient — verschachtelte Felder

backgroundGradient Felder

NameTypErforderlichBeschreibung
anglenumberJa—
colorsstring[]Ja—
Generiert aus den öffentlichen TypeScript-Deklarationen: Signaturen, Props und Standardwerte stammen aus der geprüften Quelle, Beschreibungen aus deren JSDoc. Kein Standardwert ist erfunden.