Struct viewy::components::Button
source · [−]pub struct Button {
pub label: Option<String>,
pub style: ButtonStyle,
pub icon: Option<String>,
/* private fields */
}Expand description
A control that performs an action when triggered.
Button::new("Label", ButtonStyle::Filled)
.action("/") // Here create a link to "/"Fields
label: Option<String>style: ButtonStyleicon: Option<String>Implementations
sourceimpl Button
impl Button
sourcepub fn new(label: &str, style: ButtonStyle) -> Self
pub fn new(label: &str, style: ButtonStyle) -> Self
Create new button
sourcepub fn icon_only(icon: &str, style: ButtonStyle) -> Self
pub fn icon_only(icon: &str, style: ButtonStyle) -> Self
Create new icon only button
sourcepub fn destructive(&mut self) -> Self
pub fn destructive(&mut self) -> Self
Change button style to destructive (red)
pub fn reversed(&mut self, is_reversed: bool) -> Self
sourcepub fn attach_to_form(&mut self, form_name: &str) -> Self
pub fn attach_to_form(&mut self, form_name: &str) -> Self
Make the button submit specified form
View::new()
.append_child({
Form::new("formName", "/")
})
.append_child({
Button::new("Submit", ButtonStyle::Filled)
.attach_to_form("formName")
})pub fn attach_to_file_input(&mut self, input_id: &str) -> Self
pub fn close_popup(&mut self) -> Self
Trait Implementations
sourceimpl DefaultModifiers<Button> for Button
impl DefaultModifiers<Button> for Button
fn color(&mut self, color: &str) -> Self
fn add_class(&mut self, class_name: &str) -> Self
fn remove_class(&mut self, class_name: &str) -> Self
fn padding(&mut self, padding: Vec<i32>) -> Self
fn padding_top(&mut self, value: i32) -> Self
fn padding_bottom(&mut self, value: i32) -> Self
fn padding_left(&mut self, value: i32) -> Self
fn padding_right(&mut self, value: i32) -> Self
fn margin(&mut self, margin: Vec<i32>) -> Self
fn margin_top(&mut self, value: i32) -> Self
fn margin_bottom(&mut self, value: i32) -> Self
fn margin_left(&mut self, value: i32) -> Self
fn margin_right(&mut self, value: i32) -> Self
fn width(&mut self, value: &str) -> Self
fn height(&mut self, value: &str) -> Self
fn min_width(&mut self, value: &str) -> Self
fn min_height(&mut self, value: &str) -> Self
fn max_width(&mut self, value: &str) -> Self
fn max_height(&mut self, value: &str) -> Self
fn sticky_to_top(&mut self, top: i32) -> Self
fn sticky_to_bottom(&mut self, bottom: i32) -> Self
fn align_self(&mut self, value: &str) -> Self
fn justify_self(&mut self, value: &str) -> Self
fn background_color(&mut self, color: &str) -> Self
fn display(&mut self, display: &str) -> Self
fn background_image(&mut self, url: &str) -> Self
fn background(&mut self, value: &str) -> Self
fn border(&mut self, value: &str) -> Self
fn border_left(&mut self, value: &str) -> Self
fn border_right(&mut self, value: &str) -> Self
fn border_bottom(&mut self, value: &str) -> Self
fn border_top(&mut self, value: &str) -> Self
fn tag(&mut self, tag_name: &str) -> Self
fn set_attr(&mut self, name: &str, value: &str) -> Self
fn unset_attr(&mut self, name: &str) -> Self
fn grid_area(&mut self, name: &str) -> Self
fn grid_column(&mut self, column: &str) -> Self
fn grid_row(&mut self, row: &str) -> Self
fn flex_grow(&mut self, value: i32) -> Self
fn line_height(&mut self, value: &str) -> Self
fn border_radius(&mut self, value: &str) -> Self
fn text_align(&mut self, value: &str) -> Self
fn overflow(&mut self, overflow: Overflow) -> Self
fn popover(&mut self, popover: Popover) -> Self
fn popup(&mut self, popup: Popup) -> Self
Auto Trait Implementations
impl !RefUnwindSafe for Button
impl Send for Button
impl Sync for Button
impl Unpin for Button
impl !UnwindSafe for Button
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more