pub struct OtpInput { /* private fields */ }Expand description
Material 3 segmented one-time-password / verification code input.
Numeric slots always remain in left-to-right order per Material 3 and Unicode BiDi guidance, even inside right-to-left windows, while the label and supporting/error caption follow the window’s logical direction.
Implementations§
Source§impl OtpInput
impl OtpInput
Sourcepub fn new(
id: impl Into<ElementId>,
label: impl Into<SharedString>,
state: &Entity<OtpInputState>,
) -> OtpInput
pub fn new( id: impl Into<ElementId>, label: impl Into<SharedString>, state: &Entity<OtpInputState>, ) -> OtpInput
Creates an Outlined segmented OTP input bound to state.
Sourcepub fn variant(self, variant: OtpInputVariant) -> OtpInput
pub fn variant(self, variant: OtpInputVariant) -> OtpInput
Selects Outlined or Filled slot styling.
Sourcepub fn masked(self, masked: bool) -> OtpInput
pub fn masked(self, masked: bool) -> OtpInput
Overrides whether entered digits render as bullets (•).
Sourcepub fn error(self, message: impl Into<SharedString>) -> OtpInput
pub fn error(self, message: impl Into<SharedString>) -> OtpInput
Marks the code invalid and displays an error message below the slots.
Sourcepub fn invalid(self, invalid: bool) -> OtpInput
pub fn invalid(self, invalid: bool) -> OtpInput
Marks the code invalid without replacing the supporting message.
Sourcepub fn supporting_text(self, text: impl Into<SharedString>) -> OtpInput
pub fn supporting_text(self, text: impl Into<SharedString>) -> OtpInput
Displays supporting helper text below the slots.
Sourcepub fn show_label(self, show: bool) -> OtpInput
pub fn show_label(self, show: bool) -> OtpInput
Controls whether the visible label above the slots is shown. The constructor label always remains the accessible group name.
Sourcepub fn separator_after(self, count: usize) -> OtpInput
pub fn separator_after(self, count: usize) -> OtpInput
Inserts a decorative dash separator after the index-th slot (1-based count,
e.g. separator_after(3) renders 1 2 3 - 4 5 6 for a 6-digit code).
Sourcepub fn slot_size(self, width: Pixels, height: Pixels) -> OtpInput
pub fn slot_size(self, width: Pixels, height: Pixels) -> OtpInput
Sets explicit slot width and height in logical pixels.
Sourcepub fn gap(self, gap: Pixels) -> OtpInput
pub fn gap(self, gap: Pixels) -> OtpInput
Sets horizontal spacing between slots in logical pixels (defaults to 8 px).
Sourcepub fn colors(self, colors: OtpInputColors) -> OtpInput
pub fn colors(self, colors: OtpInputColors) -> OtpInput
Supplies per-instance color overrides.
Sourcepub fn on_change(
self,
handler: impl Fn(SharedString, &mut Window, &mut App) + 'static,
) -> OtpInput
pub fn on_change( self, handler: impl Fn(SharedString, &mut Window, &mut App) + 'static, ) -> OtpInput
Invoked when user interaction changes the verification code.
Sourcepub fn on_complete(
self,
handler: impl Fn(SharedString, &mut Window, &mut App) + 'static,
) -> OtpInput
pub fn on_complete( self, handler: impl Fn(SharedString, &mut Window, &mut App) + 'static, ) -> OtpInput
Invoked when user interaction fills the final verification code slot.
Trait Implementations§
Source§impl IntoElement for OtpInput
impl IntoElement for OtpInput
Source§type Element = ViewElement<OtpInput>
type Element = ViewElement<OtpInput>
Source§fn into_element(self) -> <OtpInput as IntoElement>::Element
fn into_element(self) -> <OtpInput as IntoElement>::Element
Element.Source§fn into_any_element(self) -> AnyElement
fn into_any_element(self) -> AnyElement
AnyElement.Source§impl RenderOnce for OtpInput
impl RenderOnce for OtpInput
Source§fn render(self, window: &mut Window, cx: &mut App) -> impl IntoElement
fn render(self, window: &mut Window, cx: &mut App) -> impl IntoElement
Render::render() method
which takes a mutable reference.Auto Trait Implementations§
impl !RefUnwindSafe for OtpInput
impl !Send for OtpInput
impl !Sync for OtpInput
impl !UnwindSafe for OtpInput
impl Forget for OtpInput
impl Freeze for OtpInputwhere
NonZero<u32>: Freeze,
&'static str: Freeze,
*const ArcInner<str> is !null: Freeze,
PhantomData<ArcInner<str>>: Freeze,
*const ArcInner<Path> is !null: Freeze,
PhantomData<ArcInner<Path>>: Freeze,
*const str is !null: Freeze,
PhantomData<&'static str>: Freeze,
*const ArcInner<ElementId> is !null: Freeze,
PhantomData<ArcInner<ElementId>>: Freeze,
*const (): Freeze,
*const ArcInner<RwLock<RawRwLock, EntityRefCounts>> is !null: Freeze,
PhantomData<fn(OtpInputState) -> OtpInputState>: Freeze,
*const RcInner<dyn Fn(SharedString, &mut Window, &mut App)> is !null: Freeze,
PhantomData<RcInner<dyn Fn(SharedString, &mut Window, &mut App)>>: Freeze,
impl Move for OtpInput
impl Unpin for OtpInput
impl UnsafeUnpin for OtpInputwhere
NonZeroU32Inner: UnsafeUnpin,
&'static str: UnsafeUnpin,
*const ArcInner<str> is !null: UnsafeUnpin,
PhantomData<ArcInner<str>>: UnsafeUnpin,
*const ArcInner<Path> is !null: UnsafeUnpin,
PhantomData<ArcInner<Path>>: UnsafeUnpin,
*const str is !null: UnsafeUnpin,
PhantomData<&'static str>: UnsafeUnpin,
*const ArcInner<ElementId> is !null: UnsafeUnpin,
PhantomData<ArcInner<ElementId>>: UnsafeUnpin,
*const (): UnsafeUnpin,
*const ArcInner<RwLock<RawRwLock, EntityRefCounts>> is !null: UnsafeUnpin,
PhantomData<fn(OtpInputState) -> OtpInputState>: UnsafeUnpin,
*const RcInner<dyn Fn(SharedString, &mut Window, &mut App)> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(SharedString, &mut Window, &mut App)>>: UnsafeUnpin,
Blanket Implementations§
Source§impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
Source§fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
Source§fn with_animations(
self,
id: impl Into<ElementId>,
animations: Vec<Animation>,
animator: impl Fn(Self, usize, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
fn with_animations(
self,
id: impl Into<ElementId>,
animations: Vec<Animation>,
animator: impl Fn(Self, usize, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
Source§fn with_spring<T>(
self,
id: impl Into<ElementId>,
animation: SpringAnimation<T>,
animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static,
) -> SpringAnimationElement<Self>
fn with_spring<T>( self, id: impl Into<ElementId>, animation: SpringAnimation<T>, animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static, ) -> SpringAnimationElement<Self>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> FluentBuilder for Twhere
T: IntoElement,
impl<T> FluentBuilder for Twhere
T: IntoElement,
Source§fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
Source§fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
Source§fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
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 moreSource§impl<T> MaterialElementExt for Twhere
T: IntoElement,
impl<T> MaterialElementExt for Twhere
T: IntoElement,
Source§fn badge_label(self, text: impl Into<SharedString>) -> Badge
fn badge_label(self, text: impl Into<SharedString>) -> Badge
Badge to this element’s upper trailing edge.Source§fn badge_count(self, count: usize, maximum: usize) -> Badge
fn badge_count(self, count: usize, maximum: usize) -> Badge
Badge to this element’s upper trailing edge.Source§fn tooltip(
self,
id: impl Into<ElementId>,
text: impl Into<SharedString>,
) -> Tooltip
fn tooltip( self, id: impl Into<ElementId>, text: impl Into<SharedString>, ) -> Tooltip
Tooltip.Menu.Menu
whose items are built lazily only while the menu is open.Source§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<E> TestTextExt for Ewhere
E: IntoElement,
impl<E> TestTextExt for Ewhere
E: IntoElement,
Source§fn test_text(self, text: impl Into<SharedString>) -> ObservedText<Self::Element>
fn test_text(self, text: impl Into<SharedString>) -> ObservedText<Self::Element>
test-support, records text each time the element paints.
Otherwise returns the element it builds.Source§fn test_alt_text(
self,
text: impl Into<SharedString>,
) -> ObservedText<Self::Element>
fn test_alt_text( self, text: impl Into<SharedString>, ) -> ObservedText<Self::Element>
Self::test_text for an image’s alternative text, which
stands in for what the element draws.