Tiny Text Splitting JavaScript Library – SplitBun

Category: Javascript , Text | November 10, 2023
Views Total:44 views
Official Page:Go to website
Last Update:November 10, 2023


Tiny Text Splitting JavaScript Library – SplitBun


SplitBun is a lightweight yet robust text split JavaScript library that enables effortless breaking down of text elements into lines, words, or characters.

The library handles the heavy lifting of slicing up your text while giving control over options like specifying the type of split and passing a callback when the split completes. The wrapperClass and innerClass options let you easily style the generated elements or create engaging CSS-powered text animations.

How to use it:

1. Install and import the SplitBun.

$ npm i splitbun
import splitBun from 'splitbun'

2. Initialize the SplitBun on your text container and specify the split type: lines, words, or chars.

<div id="demo">
... text here ...
  type: 'lines'

3. Set the CSS classes of wrapper & innner elements.

  type: 'lines',
  wrapperClass: 'wrapper-ele',
  innerClass: 'inner-ele',

4. Execute a function after text splitting.

  type: 'lines',
  onComplete: () => {
    console.log('split text completed)


v1.0.13 (11/10/2023)

  • Support custom inline style

You Might Be Interested In:

Leave a Reply