Initializes the SplitText instance and saves the initial state.
Optionalprops: ISplitTextStaticProps & ISplitTextMutableProps & Partial<OptionalonCallbacks: Partial<Retrieves the module's callbacks instance.
Checks if the module has been destroyed.
Retrieves an array of letter elements.
Retrieves an array of letters metadata.
Retrieves an array of line elements.
Retrieves an array of lines metadata.
The name of the module, derived from the class name
Classname prefix for styling elements.
Current properties. Do not mutate these directly, use updateProps instead.
Retrieves an array of word elements.
Retrieves an array of words metadata.
Protected_addAdds a class name on an element, and keeps track of it for removal when the module is destroyed.
The target DOM element.
The class name to toggle.
Protected_cnHelper function to generate classnames with the module's prefix.
The class names to generate.
A string of class names with the module's prefix applied.
Protected_destroyDestroys the component.
This method does not restore the initial nodes. For this purpose, use restore().
Get default mutable properties.
Get default static properties.
Allow aria-label. false prevents adding aria-label attributes to container. String value overrides the default aria-label.
The text container where the text will be split.
Do not split certain elements. Supports string selectors, array of elements, or function.
Letter class name.
Specifies whether the text should be split into individual letters.
HTML tag to wrap each letter.
Line class name.
Specifies whether the text should be split into lines.
Specifies whether to wrap each line in an additional container.
HTML tag to wrap each line.
Line wrapper class name.
Optional callback to preprocess text before it is split into words. This function receives the original text and should return the modified text. It is useful for languages like Chinese where standard word splitting may not work correctly.
The debounce delay for the resize event in milliseconds.
Word class name.
Specifies a custom delimiter used to split text into words. By default, splitting occurs on regular whitespace.
Provides an alternative delimiter to use when outputting the split words. Useful when a custom input delimiter is used but the output should differ.
HTML tag to wrap each word.
Protected_handleMethod that is called when the module's properties mutate. In most cases, used to handle callbacks.
Destroys the module, cleaning up resources, callbacks, and event listeners.
Adds a custom callback to the module.
The event type to listen for (e.g., 'props', 'destroy').
The function to execute when the event is triggered.
Additional settings for the callback.
Adds a callback on the module's destruction.
The function to execute during destruction.
Splits the text into letters, words, and optionally lines based on configuration.
SplitTextsplits text within a container into individual lines, words, and letters.Features:
Note: Apply
fontKerning: noneto prevent layout shifts.Documentation