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.

Referência

Assinaturas

ts
(props: TextFieldProps): KuitoElement

Parâmetros

NomeTipoObrigatórioDescrição
propsTextFieldPropsSim—

Devolve

KuitoElement

Props: TextFieldProps

Props (incluindo props herdadas) 107

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

Assinaturas

ts
(text: string): string

Parâmetros

NomeTipoObrigatórioDescrição
textstringSim—

Devolve

string

onChange — assinaturas de método

Assinaturas

ts
(text: string): void

Parâmetros

NomeTipoObrigatórioDescrição
textstringSim—

Devolve

void

onSelectionChange — assinaturas de método

Assinaturas

ts
(selection: TextSelection): void

Parâmetros

NomeTipoObrigatórioDescrição
selectionTextSelectionSim—

Devolve

void

onSubmit — assinaturas de método

Assinaturas

ts
(event: SubmitEvent): void

Parâmetros

NomeTipoObrigatórioDescrição
eventSubmitEventSim—

Devolve

void

onFocus — assinaturas de método

Assinaturas

ts
(event: FocusEvent): void

Parâmetros

NomeTipoObrigatórioDescrição
eventFocusEventSim—

Devolve

void

onBlur — assinaturas de método

Assinaturas

ts
(event: FocusEvent): void

Parâmetros

NomeTipoObrigatórioDescrição
eventFocusEventSim—

Devolve

void

onPress — assinaturas de método

Assinaturas

ts
(event: PressEvent): void

Parâmetros

NomeTipoObrigatórioDescrição
eventPressEventSim—

Devolve

void

onPressCapture — assinaturas de método

Assinaturas

ts
(event: PressEvent): void

Parâmetros

NomeTipoObrigatórioDescrição
eventPressEventSim—

Devolve

void

onAction — assinaturas de método

Assinaturas

ts
(event: AccessibilityActionEvent): void

Parâmetros

NomeTipoObrigatórioDescrição
eventAccessibilityActionEventSim—

Devolve

void

backgroundGradient — campos aninhados

backgroundGradient campos

NomeTipoObrigatórioDescrição
anglenumberSim—
colorsstring[]Sim—
Gerado a partir das declarações TypeScript públicas: assinaturas, props e predefinições vêm da fonte verificada, as descrições da sua JSDoc. Nenhuma predefinição é inventada.