Skip to main content

Controls

Supported Methods

MethodDescription
start()▶️ Start the animation
pause()⏸️ Pause the animation
stop()⏹️ Stop and reset to first text
dispose()🗑️ Clean up and remove all elements

Example

App.tsx
import React from "react";
import ScrollingText from "web-scrolling-text/react";
import { ScrollingType } from "web-scrolling-text";

function App() {
const ref = React.useRef<ScrollingType>(null);

const handleStart = () => {
ref.current?.start();
};
const handleStop = () => {
ref.current?.stop();
};
const handlePause = () => {
ref.current?.pause();
};
const handleDestroy = () => {
ref.current?.dispose();
};
return (
<ScrollingText ref={ref}>
{["Hello", "World", "How", "Are", "You"]}
</ScrollingText>
);
}

export default App;