pub struct CopyButtonProps {Show 18 fields
pub value: Option<String>,
pub target: Option<String>,
pub on_copy: Option<Callback<String, bool>>,
pub label: String,
pub copied_label: String,
pub error_label: String,
pub copied_content: Option<Element>,
pub error_content: Option<Element>,
pub recovery_label: Option<String>,
pub reset_after: u64,
pub variant: ButtonVariant,
pub size: ButtonSize,
pub disabled: bool,
pub onclick: Option<EventHandler<MouseEvent>>,
pub on_state_change: Option<EventHandler<CopyButtonState>>,
pub class: Option<String>,
pub attributes: Vec<Attribute>,
pub children: Element,
}Expand description
Props for CopyButton.
Fields§
§value: Option<String>The text to copy.
target: Option<String>A CSS selector whose element’s value or text is copied when value is unset. Web and
desktop only.
on_copy: Option<Callback<String, bool>>Copies through the app instead of the browser clipboard: called with the text, it returns whether the copy succeeded. Use it on Dioxus Native, which has no clipboard API, for example with a platform clipboard crate.
label: StringAccessible name while idle. Defaults to Copy to clipboard.
copied_label: StringAccessible name and default feedback after a copy. Defaults to Copied to clipboard.
error_label: StringAccessible name and default feedback after a failure. Defaults to
Could not copy to clipboard.
copied_content: Option<Element>Content shown after a copy. Defaults to copied_label.
error_content: Option<Element>Content shown after a failure. Defaults to error_label.
recovery_label: Option<String>When set, failures reveal a read-only field with the text so it can be copied by hand, and a status region announces the outcome.
reset_after: u64Milliseconds before the feedback returns to idle. Defaults to 2000.
variant: ButtonVariantButton treatment. Defaults to outline.
size: ButtonSizeButton size.
disabled: boolDisables the button.
onclick: Option<EventHandler<MouseEvent>>Called on every activation, before copying.
on_state_change: Option<EventHandler<CopyButtonState>>Called with the outcome after each copy.
class: Option<String>Extra classes appended after the Lumen classes.
attributes: Vec<Attribute>Any other <button> or global attribute.
children: ElementIdle content. Defaults to Copy.
Implementations§
Source§impl CopyButtonProps
impl CopyButtonProps
Sourcepub fn builder() -> CopyButtonPropsBuilder<((), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), ())>
pub fn builder() -> CopyButtonPropsBuilder<((), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), ())>
Create a builder for building CopyButtonProps.
On the builder, call .value(...)(optional), .target(...)(optional), .on_copy(...)(optional), .label(...)(optional), .copied_label(...)(optional), .error_label(...)(optional), .copied_content(...)(optional), .error_content(...)(optional), .recovery_label(...)(optional), .reset_after(...)(optional), .variant(...)(optional), .size(...)(optional), .disabled(...)(optional), .onclick(...)(optional), .on_state_change(...)(optional), .class(...)(optional), .attributes(...)(optional), .children(...)(optional) to set the values of the fields.
Finally, call .build() to create the instance of CopyButtonProps.
Trait Implementations§
Source§impl Clone for CopyButtonProps
impl Clone for CopyButtonProps
Source§impl PartialEq for CopyButtonProps
impl PartialEq for CopyButtonProps
Source§impl Properties for CopyButtonPropswhere
Self: Clone,
impl Properties for CopyButtonPropswhere
Self: Clone,
Source§type Builder = CopyButtonPropsBuilder<((), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), ())>
type Builder = CopyButtonPropsBuilder<((), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), ())>
Source§fn memoize(&mut self, new: &Self) -> bool
fn memoize(&mut self, new: &Self) -> bool
Source§fn into_vcomponent<M>(
self,
render_fn: impl ComponentFunction<Self, M>,
) -> VComponentwhere
M: 'static,
fn into_vcomponent<M>(
self,
render_fn: impl ComponentFunction<Self, M>,
) -> VComponentwhere
M: 'static,
impl StructuralPartialEq for CopyButtonProps
Auto Trait Implementations§
impl !Freeze for CopyButtonProps
impl !RefUnwindSafe for CopyButtonProps
impl !Send for CopyButtonProps
impl !Sync for CopyButtonProps
impl !UnwindSafe for CopyButtonProps
impl Forget for CopyButtonProps
impl Move for CopyButtonProps
impl Unpin for CopyButtonPropswhere
*const u8 is !null: Unpin,
&'static UnsyncStorage: Unpin,
NonZero<u64>: Unpin,
&'static Location<'static>: Unpin,
Box<dyn FnMut(String) -> bool>: Unpin,
*const RcInner<Runtime> is !null: Unpin,
Rc<VNodeInner>: Unpin,
Arc<Error>: Unpin,
NonZero<u32>: Unpin,
Box<dyn FnMut(Event<MouseData>)>: Unpin,
Box<dyn FnMut(CopyButtonState)>: Unpin,
&'static str: Unpin,
Rc<RefCell<dyn FnMut(Event<dyn Any>)>>: Unpin,
Rc<dyn AnyValue>: Unpin,
impl UnsafeUnpin for CopyButtonPropswhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
&'static UnsyncStorage: UnsafeUnpin,
NonZeroU64Inner: UnsafeUnpin,
&'static Location<'static>: UnsafeUnpin,
PhantomData<Option<ExternalListenerCallback<String, bool>>>: UnsafeUnpin,
*const RcInner<VNodeInner> is !null: UnsafeUnpin,
PhantomData<RcInner<VNodeInner>>: UnsafeUnpin,
*const ArcInner<Error> is !null: UnsafeUnpin,
PhantomData<ArcInner<Error>>: UnsafeUnpin,
NonZeroU32Inner: UnsafeUnpin,
PhantomData<Option<ExternalListenerCallback<Event<MouseData>, ()>>>: UnsafeUnpin,
PhantomData<Option<ExternalListenerCallback<CopyButtonState, ()>>>: UnsafeUnpin,
PhantomData<Attribute>: UnsafeUnpin,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DependencyElement for T
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> InitializeFromFunction<T> for T
impl<T> InitializeFromFunction<T> for T
Source§fn initialize_from_function(f: fn() -> T) -> T
fn initialize_from_function(f: fn() -> T) -> T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more