pub struct ThemeToggleProps {
pub value: Option<String>,
pub default_value: Option<String>,
pub on_value_change: Option<EventHandler<String>>,
pub light_theme: String,
pub dark_theme: String,
pub apply_to_root: bool,
pub label: String,
pub onclick: Option<EventHandler<MouseEvent>>,
pub class: Option<String>,
pub attributes: Vec<Attribute>,
}Expand description
Props for ThemeToggle.
Fields§
§value: Option<String>Controlled theme name, such as light or dark.
default_value: Option<String>Initial theme when uncontrolled. Defaults to light_theme.
on_value_change: Option<EventHandler<String>>Called with the next theme name.
light_theme: StringTheme selected when leaving the dark theme. Defaults to light.
dark_theme: StringTheme selected when leaving the light theme. Defaults to dark.
apply_to_root: boolOn web and desktop, also sets data-theme and the dark class on the document root
whenever the theme changes. Ignored on Dioxus Native.
label: StringScreen-reader name. Defaults to Toggle color theme.
onclick: Option<EventHandler<MouseEvent>>Click handler, called before the theme changes.
class: Option<String>Extra classes appended after the Lumen class.
attributes: Vec<Attribute>Any other <button> or global attribute.
Implementations§
Source§impl ThemeToggleProps
impl ThemeToggleProps
Sourcepub fn builder() -> ThemeTogglePropsBuilder<((), (), (), (), (), (), (), (), (), ())>
pub fn builder() -> ThemeTogglePropsBuilder<((), (), (), (), (), (), (), (), (), ())>
Create a builder for building ThemeToggleProps.
On the builder, call .value(...)(optional), .default_value(...)(optional), .on_value_change(...)(optional), .light_theme(...)(optional), .dark_theme(...)(optional), .apply_to_root(...)(optional), .label(...)(optional), .onclick(...)(optional), .class(...)(optional), .attributes(...)(optional) to set the values of the fields.
Finally, call .build() to create the instance of ThemeToggleProps.
Trait Implementations§
Source§impl Clone for ThemeToggleProps
impl Clone for ThemeToggleProps
Source§impl PartialEq for ThemeToggleProps
impl PartialEq for ThemeToggleProps
Source§impl Properties for ThemeTogglePropswhere
Self: Clone,
impl Properties for ThemeTogglePropswhere
Self: Clone,
Source§type Builder = ThemeTogglePropsBuilder<((), (), (), (), (), (), (), (), (), ())>
type Builder = ThemeTogglePropsBuilder<((), (), (), (), (), (), (), (), (), ())>
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 ThemeToggleProps
Auto Trait Implementations§
impl !RefUnwindSafe for ThemeToggleProps
impl !Send for ThemeToggleProps
impl !Sync for ThemeToggleProps
impl !UnwindSafe for ThemeToggleProps
impl Forget for ThemeToggleProps
impl Freeze for ThemeTogglePropswhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
&'static UnsyncStorage: Freeze,
NonZero<u64>: Freeze,
&'static Location<'static>: Freeze,
PhantomData<Option<ExternalListenerCallback<String, ()>>>: Freeze,
PhantomData<Option<ExternalListenerCallback<Event<MouseData>, ()>>>: Freeze,
PhantomData<Attribute>: Freeze,
impl Move for ThemeToggleProps
impl Unpin for ThemeTogglePropswhere
*const u8 is !null: Unpin,
&'static UnsyncStorage: Unpin,
NonZero<u64>: Unpin,
&'static Location<'static>: Unpin,
Box<dyn FnMut(String)>: Unpin,
*const RcInner<Runtime> is !null: Unpin,
Box<dyn FnMut(Event<MouseData>)>: Unpin,
&'static str: Unpin,
Rc<RefCell<dyn FnMut(Event<dyn Any>)>>: Unpin,
Rc<dyn AnyValue>: Unpin,
impl UnsafeUnpin for ThemeTogglePropswhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
&'static UnsyncStorage: UnsafeUnpin,
NonZeroU64Inner: UnsafeUnpin,
&'static Location<'static>: UnsafeUnpin,
PhantomData<Option<ExternalListenerCallback<String, ()>>>: UnsafeUnpin,
PhantomData<Option<ExternalListenerCallback<Event<MouseData>, ()>>>: 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