Initializes the SplitText instance and saves the initial state.
Optional
props: StaticProps & MutablePropsProtected
_callbacksCallbacks instance
Protected
_destroyableStores actions that need to be executed when the module is destroyed
Protected
_isTracks whether the text is already split into base elements: words and letters.
Protected
_isTracks whether the module has been destroyed
Protected
_lettersList of letters metadata.
Protected
_linesList of lines metadata.
Protected
Optional
_lineUtility for wrapping words into line containers.
Protected
_propsCurrent properties
Protected
_savedSaved initial HTML nodes of the container.
Protected
_wordsList of words metadata.
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()
.
Retrieves the default mutable properties.
Retrieves the default static properties.
Protected
_handleMethod that is called when the module's properties mutate. In most cases, used to handle callbacks.
Protected
_setupSets up event listeners and handles initial splitting.
Protected
_splitSplits text into base elements: letters and words.
Protected
_splitWraps words into line containers.
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.
SplitText
splits text within a container into individual lines, words, and letters.Features:
Note: Apply
fontKerning: none
to prevent layout shifts.Documentation