pub struct TextInput {
pub name: String,
pub label: String,
pub hint_text: String,
pub value: String,
pub type: i32,
pub on_change_action: Option<Action>,
pub initial_suggestions: Option<Suggestions>,
pub auto_complete_action: Option<Action>,
pub placeholder_text: String,
}
Expand description
A field in which users can enter text. Supports suggestions and on-change actions. For an example in Google Chat apps, see Add a field in which a user can enter text.
Chat apps receive and can process the value of entered text during form input events. For details about working with form inputs, see Receive form data.
When you need to collect undefined or abstract data from users, use a text input. To collect defined or enumerated data from users, use the [SelectionInput][google.apps.card.v1.SelectionInput] widget.
Fields§
§name: String
The name by which the text input is identified in a form input event.
For details about working with form inputs, see Receive form data.
label: String
The text that appears above the text input field in the user interface.
Specify text that helps the user enter the information your app needs.
For example, if you are asking someone’s name, but specifically need their
surname, write surname
instead of name
.
Required if hintText
is unspecified. Otherwise, optional.
hint_text: String
Text that appears below the text input field meant to assist users by prompting them to enter a certain value. This text is always visible.
Required if label
is unspecified. Otherwise, optional.
value: String
The value entered by a user, returned as part of a form input event.
For details about working with form inputs, see Receive form data.
type: i32
How a text input field appears in the user interface. For example, whether the field is single or multi-line.
on_change_action: Option<Action>
What to do when a change occurs in the text input field. For example, a user adding to the field or deleting text.
Examples of actions to take include running a custom function or opening a dialog in Google Chat.
initial_suggestions: Option<Suggestions>
Suggested values that users can enter. These values appear when users click inside the text input field. As users type, the suggested values dynamically filter to match what the users have typed.
For example, a text input field for programming language might suggest
Java, JavaScript, Python, and C++. When users start typing Jav
, the list
of suggestions filters to show just Java
and JavaScript
.
Suggested values help guide users to enter values that your app can make
sense of. When referring to JavaScript, some users might enter javascript
and others java script
. Suggesting JavaScript
can standardize how users
interact with your app.
When specified, TextInput.type
is always SINGLE_LINE
, even if it’s set
to MULTIPLE_LINE
.
auto_complete_action: Option<Action>
Optional. Specify what action to take when the text input field provides suggestions to users who interact with it.
If unspecified, the suggestions are set by initialSuggestions
and
are processed by the client.
If specified, the app takes the action specified here, such as running a custom function.
placeholder_text: String
Text that appears in the text input field when the field is empty.
Use this text to prompt users to enter a value. For example, Enter a number from 0 to 100
.
Implementations§
Trait Implementations§
source§impl Message for TextInput
impl Message for TextInput
source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
source§fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
source§fn encode_to_vec(&self) -> Vec<u8>where
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8>where
Self: Sized,
source§fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
source§fn encode_length_delimited_to_vec(&self) -> Vec<u8>where
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8>where
Self: Sized,
source§fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
source§fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
source§fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self
. Read moresource§fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self
.source§impl PartialEq for TextInput
impl PartialEq for TextInput
impl StructuralPartialEq for TextInput
Auto Trait Implementations§
impl Freeze for TextInput
impl RefUnwindSafe for TextInput
impl Send for TextInput
impl Sync for TextInput
impl Unpin for TextInput
impl UnwindSafe for TextInput
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request