InputTextView when a Web App needs free-form text from someone using Meta Ray-Ban Display glasses. Activating the field opens the system input dialog on the glasses. When input is complete, the component displays the current text and reports changes to the application.import {InputTextView} from '@wearables-ui-toolkit/mrbd';
export function MessageComposer({
sendLabel,
hint,
onSend,
}: {
sendLabel: string;
hint: string;
onSend: (text: string) => void;
}) {
return (
<InputTextView
hint={hint}
actionLabel={sendLabel}
onSend={onSend}
/>
);
}
import {useState} from 'react';
import {InputTextView} from '@wearables-ui-toolkit/mrbd';
export function ControlledComposer({
sendLabel,
submitMessage,
}: {
sendLabel: string;
submitMessage: (text: string) => void;
}) {
const [text, setText] = useState('');
return (
<InputTextView
text={text}
onTextChange={setText}
onSend={message => {
submitMessage(message);
setText('');
}}
actionLabel={sendLabel}
/>
);
}
import {
InputTextView,
InputTextViewSize,
type InputTextViewInputProps,
type InputTextViewProps,
} from '@wearables-ui-toolkit/mrbd/InputTextView';
InputTextViewProps.| Prop | Type | Default | Description |
|---|---|---|---|
text | string | — | Controlled text value. |
defaultText | string | '' | Initial text for uncontrolled usage. |
hint | string | 'Start writing' | Placeholder and default accessible name. Pass localized copy. |
size | InputTextViewSize | InputTextViewSize.FULL | Full-width or compact-while-empty layout. |
material | ContainerMaterial | MaterialLibrary.textInput() | Material for the input field. |
showLoader | boolean | false | Shows loading feedback within the field. |
loadingLabel | string | 'Loading' | Accessible label for the loading state. Pass a localized label. |
actionIcon | IconSource | paper airplane | Icon for the optional action. |
actionButtonMaterial | ContainerMaterial | MaterialLibrary.outboundMessage() | Material for the optional action button. |
actionLabel | string | 'Send' | Accessible label for the optional action. Pass a localized label. |
showActionButton | boolean | true | Whether to show the separate action button when onSend is set. Submission from the system input dialog remains available when the button is hidden. |
onSend | (text: string) => void | — | Enables submission and receives submitted text. |
onTextChange | (text: string) => void | — | Called when the text changes. |
inputProps | InputTextViewInputProps | {} | Additional text-input attributes, including form, validation, and accessibility attributes. |
className | string | '' | Additional class on the component. |
style | CSSProperties | {} | Additional inline styles on the component. |
inputProps for supported attributes such as name, disabled, readOnly, required, maxLength, autoComplete, inputMode, and aria-*. The component also accepts standard React attributes for accessibility and application metadata.InputTextViewSize controls how the field uses the available width.| Member | Description |
|---|---|
FULL | Fills the available width. When the separate action is visible, the component leaves room for it. |
SHRINK_WHEN_EMPTY | Fits the localized hint while empty, then expands to the available width after text is entered. |
InputTextView and the component displays the current text.onTextChange to observe changes. In controlled mode, pass the updated value back through text. In uncontrolled mode, the component keeps its own value, starting with defaultText.onSend enables submission from the system input dialog and the optional action button. The visible action is disabled while the field is empty. Empty submission attempts do not call onSend.onTextChange. A controlled field changes only when the application updates text.showLoader to show loading feedback within the field. The component uses loadingLabel as the accessible name for that state and respects reduced-motion preferences. Loading feedback does not submit text or replace the optional action.hint provides the field’s accessible name by default. Pass a more specific, localized aria-label through inputProps when needed.actionLabel names the optional action; its icon is decorative.loadingLabel names the loading state.disabled, readOnly, required, and aria-describedby through inputProps.hint, actionLabel, and loadingLabel values.inputProps for supported validation and accessibility attributes.InputTextView already manages overflow after the third visible line.onSend and provide the next action elsewhere in the interface.