@gfazioli/mantine-text-animate
Version:
The TextAnimate component allows you to animate text with various effects.
68 lines (67 loc) • 1.68 kB
TypeScript
export interface TypewriterBaseProps {
/**
* The text or array of texts to display in typewriter effect
*/
value: string | string[];
/**
* Controls if the animation is running (`true`) or reset (false)
* @default true
*/
animate?: boolean;
/**
* Whether to display text in multiple lines
* @default false
*/
multiline?: boolean;
/**
* The typing speed in seconds per character
* @default 0.03
*/
speed?: number;
/**
* The delay between text changes in milliseconds (when using multiple texts)
* @default 2000
*/
delay?: number;
/**
* Whether to loop through the texts
* @default true
*/
loop?: boolean;
/**
* Callback function to be called when the typing animation ends
*/
onTypeEnd?: () => void;
/**
* Callback function to be called when the typing animation is looped
* and the animation is about to start again
*/
onTypeLoop?: () => void;
}
export interface UseTypewriterResult {
/**
* The current text being displayed
* If multiline is true, this will be an array of strings
*/
text: string | string[];
/**
* Whether the typewriter is currently typing
*/
isTyping: boolean;
/**
* Start the typewriter animation
*/
start: () => void;
/**
* Stop the typewriter animation
*/
stop: () => void;
/**
* Reset the typewriter to its initial state
*/
reset: () => void;
}
/**
* A hook that creates a typewriter effect
*/
export declare function useTypewriter(options: TypewriterBaseProps): UseTypewriterResult;