Options / Props

Options

Component Props

NameTypeDescriptionExampleDefault
sequenceArray<number | string | (() => void | Promise<void>)>Animation sequence consisting of: [TEXT, DELAY-IN-MS, CALLBACK-FUNC]['One', 1000, 'Two', () => console.log('done typing!')]-
wrapperstringHTML element name that wraps the typing animation. See 'Wrapper CSS' section for related infop,h2,div, strongspan
repeatnumberAmount of animation repetitions. e.g. 0 = Animation will only be typed out once1, 3, Infinity0
cursorbooleanWhether to display default blinking cursor css-animationtrue, falsetrue
preRenderFirstStringbooleanIf set to true, the first string of your sequence will not be animated and initially (pre-)renderedtrue, falsefalse
speed1,2,..,99 | {type: "keyStrokeDelayInMs", value: number}Basic typing speed from 1-99 or exact keystroke delay in milseconds25, 50, 99, {type: 'keyStrokeDelayInMs', value: 250}40
deletionSpeed1,2,..,99 | {type: "keyStrokeDelayInMs", value: number}Basic deletion speed from 1-99 or exact keystroke delay in milseconds25, 50, 99, {type: 'keyStrokeDelayInMs', value: 250}speed
omitDeletionAnimationbooleanIf true, deletions will be instant and without animationtrue, falsefalse
classNamestringHTML class name applied to the wrapper of the typing animationsome-class-name-
styleobjectJSX inline style object that will be applied to the wrapper of the typing animation{fontSize: '2em'}-
refHTMLElement | nullA React ref that will be passed to the wrapper of the typing animation--
splitter(text: string) => Array<string>Custom string splitter, e.g for typing complex characters, such as those handled by the npm package "grapheme-splitter"(str) => new GraphemeSplitter().splitGraphemes(str)(str) => [...str]

Props Examples

See all examples to see all props in usage.

  • ref, className see here.
  • speed, deletionSpeed see here.
  • preRenderFirstString see here.
  • splitter see here

Custom Cursor Animation

If you wish to apply a custom cursor animation, set the cursor prop to false and set a custom className prop to the <TypeAnimation/> component with your own css styles.

yourCssModule.module.css
.type::after {
  content: '|';
  animation: cursor 1.1s infinite step-start;
}
 
@keyframes cursor {
  50% {
    opacity: 0;
  }
}
import styles from './yourCssModule.module.css';
 
<TypeAnimation
  cursor={false} // omit the default css typing animation class
  className={styles.type}
  sequence={['One', 800, 'One Two']}
/>;

Stop cursor animation

If you would like the cursor to stop being displayed at a specific sequence step, see here.