pub struct SelectElement {
pub id: String,
pub label: String,
pub placeholder: Option<String>,
pub options: Vec<SelectOption>,
pub initial_option: Option<String>,
}Expand description
A dropdown select element.
Fields§
§id: StringUnique identifier for the select (used in submission payloads).
label: StringLabel displayed above the select.
placeholder: Option<String>Placeholder text shown when no option is selected.
options: Vec<SelectOption>Available options.
initial_option: Option<String>Value of the initially selected option.
Implementations§
Source§impl SelectElement
impl SelectElement
Sourcepub fn new(id: impl Into<String>, label: impl Into<String>) -> Self
pub fn new(id: impl Into<String>, label: impl Into<String>) -> Self
Create a new select with the given identifier and label.
Sourcepub fn placeholder(self, placeholder: impl Into<String>) -> Self
pub fn placeholder(self, placeholder: impl Into<String>) -> Self
Set placeholder text.
Sourcepub fn option(self, option: SelectOption) -> Self
pub fn option(self, option: SelectOption) -> Self
Append an option.
Sourcepub fn initial_option(self, value: impl Into<String>) -> Self
pub fn initial_option(self, value: impl Into<String>) -> Self
Set the initially selected option by value.
Trait Implementations§
Source§impl Clone for SelectElement
impl Clone for SelectElement
Source§fn clone(&self) -> SelectElement
fn clone(&self) -> SelectElement
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SelectElement
impl Debug for SelectElement
Source§impl<'de> Deserialize<'de> for SelectElement
impl<'de> Deserialize<'de> for SelectElement
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for SelectElement
impl RefUnwindSafe for SelectElement
impl Send for SelectElement
impl Sync for SelectElement
impl Unpin for SelectElement
impl UnsafeUnpin for SelectElement
impl UnwindSafe for SelectElement
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
Mutably borrows from an owned value. Read more