Skip to main content

Crate dioxus_type_animation

Crate dioxus_type_animation 

Source
Expand description

Dioxus port of the react-type-animation typewriter component.

The main entry point is TypeAnimation. It mirrors the React library’s feature set with Dioxus-friendly Rust types: a sequence of text, delays, and callbacks; configurable speed/deletion speed; finite or infinite repetition; wrapper element selection; optional cursor CSS; and custom text splitting.

§Example

use dioxus::prelude::*;
use dioxus_type_animation::{Repeat, SequenceElement, Speed, TypeAnimation};

fn App() -> Element {
    rsx! {
        TypeAnimation {
            sequence: vec![
                SequenceElement::from("We produce food for Mice"),
                SequenceElement::from(1000_u64),
                SequenceElement::from("We produce food for Hamsters"),
                SequenceElement::from(1000_u64),
            ],
            speed: Speed::Preset(50),
            repeat: Repeat::Infinite,
            style: Some("font-size: 2em; display: inline-block;".to_string()),
        }
    }
}

Structs§

TypeAnimationProps
Props for TypeAnimation.

Enums§

Repeat
Repeat behavior for an animation sequence.
SequenceElement
A single animation sequence item.
Speed
Speed configuration equivalent to the React library’s speed and deletionSpeed props.
Wrapper
HTML wrapper element used by TypeAnimation.

Constants§

CURSOR_CSS
CSS used by TypeAnimation when cursor is enabled.

Functions§

TypeAnimation
Dioxus typewriter animation component inspired by react-type-animation.

Type Aliases§

SequenceCallback
Callback entry in an animation sequence.
StringSplitter
Function used to split a string into editable units.