Skip to content

TextInput example

text-input is controlled through a value prop and a text-change event. The controlled write handshake is shared; the public event name is framework-shaped.

import './NameInput.css';
import { useState } from 'react';
export function NameInput() {
const [name, setName] = useState('Symbiote');
return (
<view className="root">
<text-input value={name} onValueChange={event => setName(event.text)} className="input" />
<text>Hello, {name}</text>
</view>
);
}
NameInput.css
.root { gap: 12px; }
.input { min-width: 220px; padding: 12px; border-width: 1px; }
Concern React Vue Angular Svelte Solid
Text prop value :value
or v-model
[value]
or [(value)]
value value
Text change onValueChange={event => …} @value-change
or v-model
(valueChange)="handler($event)" (text only) onValueChange={event => …} onValueChange={event => …}
Native event (same event object) (same emit, same event object) (change)="handler($event)" (separate output) (same event object) (same event object)

All five now share one contract: onValueChange (or its per-adapter emit/output spelling) is called with a single change-event object, event.text carries the current text, and event itself is the native change event — there is no separate second argument anywhere. Angular is the one exception, since its (valueChange) output is deliberately text-only to keep [(value)] working, with (change) carrying the full event instead.

StyleSheet.create works identically to a CSS class if you’d rather keep style objects inline — see the Styling guide.