Interface ISplitTextStaticProps

Static properties for the SplitText module

interface ISplitTextStaticProps {
    __staticProp?: true;
    ariaLabel?: string | boolean;
    container: HTMLElement;
    ignore?: null | string | HTMLElement[] | (element: HTMLElement) => boolean;
    letterClass?: string;
    letters?: boolean;
    letterTag?: keyof HTMLElementTagNameMap;
    lineClass?: string;
    lines?: boolean;
    linesWrapper?: boolean;
    lineTag?: keyof HTMLElementTagNameMap;
    lineWrapperClass?: string;
    prepareText?: (text: string) => string;
    resizeDebounce?: number;
    wordClass?: string;
    wordDelimiter?: string;
    wordDelimiterOutput?: null | string;
    wordTag?: keyof HTMLElementTagNameMap;
}

Hierarchy (View Summary)

Properties

__staticProp?: true
ariaLabel?: string | boolean

Allow aria-label. false prevents adding aria-label attributes to container. String value overrides the default aria-label.

true
container: HTMLElement

The text container where the text will be split.

ignore?: null | string | HTMLElement[] | (element: HTMLElement) => boolean

Do not split certain elements. Supports string selectors, array of elements, or function.

null
letterClass?: string

Letter class name.

v-split-text__letter

letters?: boolean

Specifies whether the text should be split into individual letters.

false
letterTag?: keyof HTMLElementTagNameMap

HTML tag to wrap each letter.

span

lineClass?: string

Line class name.

v-split-text__line

lines?: boolean

Specifies whether the text should be split into lines.

false
linesWrapper?: boolean

Specifies whether to wrap each line in an additional container.

false
lineTag?: keyof HTMLElementTagNameMap

HTML tag to wrap each line.

span

lineWrapperClass?: string

Line wrapper class name.

v-split-text__line-wrapper

prepareText?: (text: string) => string

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.

const segmenter = new Intl.Segmenter('zh', { granularity: 'word' });

const instance = new SplitText({
container,
prepareText: (source) => [...segmenter.segment(source)].map((s) => s.segment).join(' '),
});
resizeDebounce?: number

The debounce delay for the resize event in milliseconds.

0
wordClass?: string

Word class name.

v-split-text__word

wordDelimiter?: string

Specifies a custom delimiter used to split text into words. By default, splitting occurs on regular whitespace.

" "
wordDelimiterOutput?: null | string

Provides an alternative delimiter to use when outputting the split words. Useful when a custom input delimiter is used but the output should differ.

null
wordTag?: keyof HTMLElementTagNameMap

HTML tag to wrap each word.

span