Forms · Select and TextInput label: the name assistive technology reads, drawn nowhere

This commit is contained in:
ZacharyZhang-NY committed 2026-10-05 04:59:41 -04:00
1 parent e21336fc1b
commit 8658999903
4 files changed
+25 -3

No files matched your search

+8
View File
@@ -51,6 +51,7 @@ pub struct TextInput {
focus: FocusHandle,
text: String,
placeholder: SharedString,
label: SharedString,
selection: Range<usize>,
reversed: bool,
marked: Option<Range<usize>>,
@@ -105,6 +106,7 @@ impl TextInput {
focus,
text: String::new(),
placeholder: SharedString::default(),
label: SharedString::default(),
selection: 0..0,
reversed: false,
marked: None,
@@ -141,6 +143,12 @@ impl TextInput {
self
}
/// The name assistive technology reads; the placeholder otherwise.
pub fn label(mut self, text: impl Into<SharedString>) -> Self {
self.label = text.into();
self
}
/// Shows bullets instead of the text, and keeps it off the clipboard.
pub fn masked(mut self) -> Self {
self.masked = true;