跳到正文

Input

由核心管理的受控文本编辑器,支持原生键盘和文本服务。

正在加载交互演示…

#导入

从 quickgui 导入 text_input。

use quickgui::*;

#用法

text_input(name.as_str())
    .placeholder("Name")
    .on_input(edit)

#API 参考

展开条目查看说明和完整签名。短横线表示声明中未记录默认值。

text_input

查看源码
pub fn text_input(value: impl Into<Arc<str>>) -> Element

Create a controlled, single-line text input. Attach a stable [`crate::InputListener`] with [`Element::on_input`].

on_inputpub fn on_input<V>(mut self, listener: crate::InputListener<V>) -> Self—

Attach a controlled-value listener registered by [`crate::ViewContext::input_listener`].

pub fn on_input<V>(mut self, listener: crate::InputListener<V>) -> Self
查看源码
placeholderpub fn placeholder(mut self, placeholder: impl Into<Arc<str>>) -> Self—

Set placeholder text for a [`text_input`] element.

pub fn placeholder(mut self, placeholder: impl Into<Arc<str>>) -> Self
查看源码
childpub fn child(mut self, child: impl IntoElement) -> Self—

Configures child for this part.

pub fn child(mut self, child: impl IntoElement) -> Self
查看源码