ButtonProps

Struct ButtonProps 

Source
pub struct ButtonProps {
Show 28 fields pub type: ButtonType, pub size: ButtonSize, pub shape: ButtonShape, pub danger: bool, pub ghost: bool, pub block: bool, pub loading: bool, pub loading_delay: Option<u64>, pub loading_icon: Option<Element>, pub auto_insert_space: bool, pub label: Option<String>, pub icon_only: Option<bool>, pub disabled: bool, pub color: Option<ButtonColor>, pub variant: Option<ButtonVariant>, pub icon_placement: ButtonIconPlacement, pub icon_position: Option<ButtonIconPlacement>, pub icon: Option<Element>, pub href: Option<String>, pub class: Option<String>, pub class_names_root: Option<String>, pub class_names_icon: Option<String>, pub class_names_content: Option<String>, pub styles_root: Option<String>, pub html_type: ButtonHtmlType, pub data_attributes: Option<Vec<(String, String)>>, pub onclick: Option<EventHandler<MouseEvent>>, pub children: Element,
}
Expand description

Props for the Ant Design flavored button.

Note: The loading property in Ant Design TypeScript supports an object form { delay?: number, icon?: ReactNode }. In this Rust implementation, it is split into loading (boolean), loading_delay (Option), and loading_icon (Option) for better type safety and clarity.

Fields§

§type: ButtonType§size: ButtonSize§shape: ButtonShape§danger: bool§ghost: bool§block: bool§loading: bool

Whether the button is in loading state. Note: In Ant Design TypeScript, this can be a boolean or an object { delay?: number, icon?: ReactNode }. Here it is split into loading, loading_delay, and loading_icon for better type safety.

§loading_delay: Option<u64>

Optional loading delay in milliseconds before showing spinner.

§loading_icon: Option<Element>

Custom loading icon.

§auto_insert_space: bool

If true, inserts a space between two CJK chars (antd behavior).

§label: Option<String>

Optional label text used for auto spacing/icon-only detection; if set, overrides children text for button content.

§icon_only: Option<bool>

Mark as icon-only (adds class); if unset, derives from label being empty with an icon.

§disabled: bool§color: Option<ButtonColor>§variant: Option<ButtonVariant>§icon_placement: ButtonIconPlacement

Icon placement relative to content.

§icon_position: Option<ButtonIconPlacement>

@deprecated Please use icon_placement instead. This property is kept for backward compatibility and will be mapped to icon_placement.

§icon: Option<Element>§href: Option<String>§class: Option<String>§class_names_root: Option<String>

Extra class applied to button element (aligned to antd classNames.root).

§class_names_icon: Option<String>

Extra class applied to icon span.

§class_names_content: Option<String>

Extra class applied to content span.

§styles_root: Option<String>

Extra inline style applied to root.

§html_type: ButtonHtmlType

Native button type, used when rendering as <button>.

§data_attributes: Option<Vec<(String, String)>>

Data attributes as a map of key-value pairs. Keys should be without the “data-” prefix. For example, data_attributes: Some([("test", "value")]) will render as data-test="value".

§onclick: Option<EventHandler<MouseEvent>>§children: Element

Implementations§

Source§

impl ButtonProps

Source

pub fn builder() -> ButtonPropsBuilder<((), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), ())>

Create a builder for building ButtonProps. On the builder, call .r#type(...)(optional), .size(...)(optional), .shape(...)(optional), .danger(...)(optional), .ghost(...)(optional), .block(...)(optional), .loading(...)(optional), .loading_delay(...)(optional), .loading_icon(...)(optional), .auto_insert_space(...)(optional), .label(...)(optional), .icon_only(...)(optional), .disabled(...)(optional), .color(...)(optional), .variant(...)(optional), .icon_placement(...)(optional), .icon_position(...)(optional), .icon(...)(optional), .href(...)(optional), .class(...)(optional), .class_names_root(...)(optional), .class_names_icon(...)(optional), .class_names_content(...)(optional), .styles_root(...)(optional), .html_type(...)(optional), .data_attributes(...)(optional), .onclick(...)(optional), .children(...)(optional) to set the values of the fields. Finally, call .build() to create the instance of ButtonProps.

Trait Implementations§

Source§

impl Clone for ButtonProps

Source§

fn clone(&self) -> ButtonProps

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl PartialEq for ButtonProps

Source§

fn eq(&self, other: &ButtonProps) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Properties for ButtonProps
where Self: Clone,

Source§

type Builder = ButtonPropsBuilder<((), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), ())>

The type of the builder for this component. Used to create “in-progress” versions of the props.
Source§

fn builder() -> Self::Builder

Create a builder for this component.
Source§

fn memoize(&mut self, new: &Self) -> bool

Make the old props equal to the new props. Return if the props were equal and should be memoized.
Source§

fn into_vcomponent<M>( self, render_fn: impl ComponentFunction<Self, M>, ) -> VComponent
where M: 'static,

Create a component from the props.
Source§

impl StructuralPartialEq for ButtonProps

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> InitializeFromFunction<T> for T

Source§

fn initialize_from_function(f: fn() -> T) -> T

Create an instance of this type from an initialization function
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<Ret> SpawnIfAsync<(), Ret> for Ret

Source§

fn spawn(self) -> Ret

Spawn the value into the dioxus runtime if it is an async block
Source§

impl<T, O> SuperFrom<T> for O
where O: From<T>,

Source§

fn super_from(input: T) -> O

Convert from a type to another type.
Source§

impl<T, O, M> SuperInto<O, M> for T
where O: SuperFrom<T, M>,

Source§

fn super_into(self) -> O

Convert from a type to another type.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DependencyElement for T
where T: 'static + PartialEq + Clone,