Collect editable text. Use it for search, account details and forms.

Bind a search field to state

tsx
import { TextField, VStack, signal, Text } from 'kuito';

export default function Search() {
  const query = signal('');

  return (
    <VStack padding={16} gap={8}>
      <TextField label="Search" placeholder="Artists, albums" type="search" value={query} />
      <Text>{query.value}</Text>
    </VStack>
  );
}

Behavior

Pass a signal as value for two-way input. Choose type for the keyboard and input purpose. A label remains useful to accessibility even when a placeholder disappears. Use format for input formatting, and show validation feedback beside the field.

Continue

Read Keyboard for a complete workflow. See the complete prop reference for types and documented defaults.

Reference

Signatures

ts
(props: TextFieldProps): KuitoElement

Parameters

NameTypeRequiredDescription
propsTextFieldPropsYes—

Returns

KuitoElement

Props: TextFieldProps

Props (including inherited props) 107

NameTypeRequiredDescription
format(text: string) => stringNoThe 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) => voidNoThe text, as the user changes it.
onSelectionChange(selection: TextSelection) => voidNoThe selected range, as the user moves the caret or selects.
onSubmit(event: SubmitEvent) => voidNo—
onFocus(event: FocusEvent) => voidNo—
onBlur(event: FocusEvent) => voidNo—
idstringNo—
refElementRef<ElementHandle>No—
classProp<ClassNames>NoClass names from a .css import or styles(): a string, or a list with falsy entries skipped, following the signals it reads.
styleStyleDeclarationsNoStyles 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) => voidNo—
onPressCapture(event: PressEvent) => voidNo—
keystring | numberNo—
hiddenProp<boolean>NoTakes the view out of layout and off screen, as CSS display: none.
paddingProp<LengthPercentage>No—
paddingTopProp<LengthPercentage>No—
paddingRightProp<LengthPercentage>No—
paddingBottomProp<LengthPercentage>No—
paddingLeftProp<LengthPercentage>No—
widthAnimatable<SizeValue>No—
heightAnimatable<SizeValue>No—
minWidthProp<SizeValue>No—
maxWidthProp<SizeValue>No—
minHeightProp<SizeValue>No—
maxHeightProp<SizeValue>No—
aspectRatioProp<number>NoWidth divided by height; sizes the missing side from the other.
positionProp<"relative" | "absolute">No—
topProp<LengthPercentageAuto>No—
rightProp<LengthPercentageAuto>No—
bottomProp<LengthPercentageAuto>No—
leftProp<LengthPercentageAuto>No—
marginProp<LengthPercentageAuto>No—
marginTopProp<LengthPercentageAuto>No—
marginRightProp<LengthPercentageAuto>No—
marginBottomProp<LengthPercentageAuto>No—
marginLeftProp<LengthPercentageAuto>No—
flexGrowProp<number>No—
flexShrinkProp<number>No—
flexBasisProp<SizeValue | "content">No—
flexProp<number>NoA grow factor from a zero basis, as CSS flex: n; 0 is inflexible.
alignSelfProp<"auto" | SelfAlignment>No—
directionProp<"ltr" | "rtl">NoThe way lines run; unset, the parent's, and the app's first language's at the root.
boxSizingProp<"border-box" | "content-box">No—
paddingInlineStartProp<LengthPercentage>NoPadding on the side lines start from: the left in ltr, the right in rtl.
paddingInlineEndProp<LengthPercentage>NoPadding on the side lines end at: the right in ltr, the left in rtl.
marginInlineStartProp<LengthPercentageAuto>NoMargin on the side lines start from: the left in ltr, the right in rtl.
marginInlineEndProp<LengthPercentageAuto>NoMargin on the side lines end at: the right in ltr, the left in rtl.
insetInlineStartProp<LengthPercentageAuto>Noleft in ltr, right in rtl.
insetInlineEndProp<LengthPercentageAuto>Noright in ltr, left in rtl.
roleProp<Role>No—
onAction(event: AccessibilityActionEvent) => voidNoThe screen reader action taken, by name.
accessibleProp<boolean>NoMakes the view one screen reader element, read as its label or its children's text.
labelProp<string>NoWhat a screen reader says for the view.
hintProp<string>NoWhat happens when the view is activated, read after the label.
aria-hiddenProp<boolean>NoScreen readers skip the view and its subtree.
actionsProp<readonly AccessibilityAction[]>NoActions a screen reader offers; onAction receives the one taken.
liveProp<"off" | "polite" | "assertive">NoARIA's aria-live: announces changes to the view's content, on iOS too.
aria-disabledProp<boolean>No—
aria-selectedProp<boolean>No—
aria-checkedProp<boolean | "mixed">No—
aria-busyProp<boolean>No—
aria-expandedProp<boolean>No—
aria-valueminProp<number>No—
aria-valuemaxProp<number>No—
aria-valuenowProp<number>No—
aria-valuetextProp<string>No—
gesturesreadonly Composable[]NoThe view's gestures; several race unless composed with together or orElse.
opacityAnimatable<number>No—
backgroundColorAnimatable<string>No—
translateXAnimatable<number>No—
translateYAnimatable<number>No—
scaleAnimatable<number>No—
scaleXAnimatable<number>No—
scaleYAnimatable<number>No—
rotateAnimatable<number>NoDegrees.
transitionPartial<Record<"opacity" | "backgroundColor" | "transform" | "borderRadius" | "borderColor" | "shadow" | "width" | "height" | "all", Animation<unknown> | AnimationSpec>>NoHow the animatable props move when they change, enter or leave, by group; a CSS transition compiles to it.
animatePartial<Record<AnimatableProps, string | number>>NoAnimatable props whose every change moves as transition says; the first value applies at once.
enterEffectNoWhere the view enters from: fade.and(slide.up(12)).
exitProp<Effect>NoWhere the view leaves to; it stays on screen until it is there. The renderer gets true, and keeps the view until exited.
layoutAnimation<number>NoHow the view moves to a new frame the layout gives it: layout={spring()}.
borderRadiusAnimatable<number>No—
overflowProp<"visible" | "hidden" | "clip" | "scroll">Nohidden and scroll clip; as in CSS, either lets a flex item shrink below its content.
borderWidthProp<number>No—
borderColorAnimatable<string>No—
shadowColorAnimatable<string>No—
shadowRadiusAnimatable<number>No—
shadowOffsetXAnimatable<number>No—
shadowOffsetYAnimatable<number>No—
backgroundGradient{ angle: number; colors: string[];}No—
colorProp<string>No—
sharedIdProp<string>NoA 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>NoThe field's text, as HTML's value.
disabledProp<boolean>NoTakes no presses or input, as HTML disabled.
placeholderProp<string>No—
placeholderColorProp<string>NoThe placeholder's color.
selectionColorProp<string>NoThe cursor and selection color.
enterKeyHintProp<"enter" | "done" | "go" | "next" | "search" | "send">NoHTML's enterkeyhint: the enter key's label. next moves focus to the next input natively.
submitBehaviorProp<"submit" | "blurAndSubmit" | "newline">NoWhat 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>NoFocuses the input once it is on screen.
typeProp<"number" | "search" | "text" | "password" | "email" | "tel" | "url">NoHTML's input type: the keyboard, and password hides the text.
inputModeProp<InputMode>NoHTML'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">NoHTML's autocomplete: what the field holds, for autofill and the password manager.
autoCapitalizeProp<"none" | "sentences" | "words" | "characters">NoHTML's autocapitalize. Unset, sentences for text and search fields and none for the others.
maxLengthProp<number>NoHTML's maxlength: the most UTF-16 code units the user can enter. Text the app sets is not cut.
spellCheckProp<boolean>NoHTML's spellcheck, which also turns autocorrection on or off. Unset, on for text and search fields.
linesProp<number | { min?: number; max?: number;}>NoWraps 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>NoThe 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 — method signatures

Signatures

ts
(text: string): string

Parameters

NameTypeRequiredDescription
textstringYes—

Returns

string

onChange — method signatures

Signatures

ts
(text: string): void

Parameters

NameTypeRequiredDescription
textstringYes—

Returns

void

onSelectionChange — method signatures

Signatures

ts
(selection: TextSelection): void

Parameters

NameTypeRequiredDescription
selectionTextSelectionYes—

Returns

void

onSubmit — method signatures

Signatures

ts
(event: SubmitEvent): void

Parameters

NameTypeRequiredDescription
eventSubmitEventYes—

Returns

void

onFocus — method signatures

Signatures

ts
(event: FocusEvent): void

Parameters

NameTypeRequiredDescription
eventFocusEventYes—

Returns

void

onBlur — method signatures

Signatures

ts
(event: FocusEvent): void

Parameters

NameTypeRequiredDescription
eventFocusEventYes—

Returns

void

onPress — method signatures

Signatures

ts
(event: PressEvent): void

Parameters

NameTypeRequiredDescription
eventPressEventYes—

Returns

void

onPressCapture — method signatures

Signatures

ts
(event: PressEvent): void

Parameters

NameTypeRequiredDescription
eventPressEventYes—

Returns

void

onAction — method signatures

Signatures

ts
(event: AccessibilityActionEvent): void

Parameters

NameTypeRequiredDescription
eventAccessibilityActionEventYes—

Returns

void

backgroundGradient — nested fields

backgroundGradient fields

NameTypeRequiredDescription
anglenumberYes—
colorsstring[]Yes—
Generated from the public TypeScript declarations: signatures, props and defaults come from the checked source, descriptions from its JSDoc. No defaults are invented.