All Projects → callmecavs → Text Split

callmecavs / Text Split

Text wrapping for type animations.

Programming Languages

javascript
184084 projects - #8 most used programming language
type
21 projects

Labels

Projects that are alternatives of or similar to Text Split

split
A string split function and iterator for Lua
Stars: ✭ 15 (-67.39%)
Mutual labels:  text, split
Splitting
JavaScript microlibrary to split an element by words, characters, children and more, populated with CSS variables!
Stars: ✭ 1,222 (+2556.52%)
Mutual labels:  text, split
Ggrepel
📍 Repel overlapping text labels away from each other.
Stars: ✭ 853 (+1754.35%)
Mutual labels:  text
Gpt2 Telegram Chatbot
GPT-2 Telegram Chat bot
Stars: ✭ 41 (-10.87%)
Mutual labels:  text
Verticalize
Simple tool to verticalize text delimited files.
Stars: ✭ 32 (-30.43%)
Mutual labels:  text
Tui
A text-based user interface library for golang based on termbox
Stars: ✭ 12 (-73.91%)
Mutual labels:  text
Femto
A toy text editor with no dependencies written in Ruby
Stars: ✭ 34 (-26.09%)
Mutual labels:  text
Numericaltextentry
An iOS library for beautiful number entry fields. iPad friendly. Written in Swift.
Stars: ✭ 16 (-65.22%)
Mutual labels:  text
Mybox
Easy tools of document, image, file, network, location, color, and media.
Stars: ✭ 45 (-2.17%)
Mutual labels:  text
Javascript Client
NodeJS and Browser SDK client for Split Software
Stars: ✭ 30 (-34.78%)
Mutual labels:  split
Header
Header Tool for Editor.js 2.0
Stars: ✭ 39 (-15.22%)
Mutual labels:  text
Text Minimap
Generate text minimap/preview using Braille Patterns
Stars: ✭ 21 (-54.35%)
Mutual labels:  text
Typographie
Web service for preparation of Russian texts for the web publication
Stars: ✭ 12 (-73.91%)
Mutual labels:  text
Nlp Experiments In Pytorch
PyTorch repository for text categorization and NER experiments in Turkish and English.
Stars: ✭ 35 (-23.91%)
Mutual labels:  text
Flutterplayground
Playground app for Flutter
Stars: ✭ 859 (+1767.39%)
Mutual labels:  text
Urlify
A simple macOS app to create valid file and url names from clipboard text.
Stars: ✭ 44 (-4.35%)
Mutual labels:  text
Ps Webapi
(Migrated from CodePlex) Let PowerShell Script serve or command-line process as WebAPI. PSWebApi is a simple library for building ASP.NET Web APIs (RESTful Services) by PowerShell Scripts or batch/executable files out of the box.
Stars: ✭ 24 (-47.83%)
Mutual labels:  text
Node Html To Text
Advanced html to text converter
Stars: ✭ 872 (+1795.65%)
Mutual labels:  text
Layout Spliter
Split label(horizontal,vertical),you can make a layout whatever you want !
Stars: ✭ 34 (-26.09%)
Mutual labels:  split
Art
🎨 ASCII art library for Python
Stars: ✭ 1,026 (+2130.43%)
Mutual labels:  text

text-split

text-split on Travis text-split on NPM text-split Downloads on NPM Standard JavaScript Style

Text wrapping for type animations.

Install

$ npm install text-split --save

Why?

To address some prior art:

  • Lettering.js - dependent on jQuery
  • charming
    • less straightforward (child nodes are recursed through for text content)
    • less flexible (mandatory class and aria attributes are added, no per piece callback)

With only 1 method and 4 options, text-split offers the most control via the smallest API surface area.

Getting Started

import splitter from 'text-split'

// a target node is required
const target = document.querySelector('.heading')

// pass in the target node
// get back the newly created nodes wrapping the target text (in an array)
const created = splitter(target)

Read more about options below to handle more complex use cases.

Options

All options have defaults, as shown here:

const defaults = {
  a11y = true,
  delimeter = 'letter',
  each = null,
  element = 'span'
}

Each option is explained in further detail below:

a11y

Enable (default) or disable setting of aria attributes on parent and created child nodes.

splitter(target, { a11y: false })

delimeter

Either letter (default) or word, indicating how to break up the target text before wrapping it.

splitter(target, { delimeter: 'word' })

each

A function that, if it exists, is called and passed:

  • the created node, with appropriate textContent
  • the 0-based node index (relative to the other created nodes)
  • the DocumentFragment that stores the nodes created (thus far)

This is the fun part escape hatch.

splitter(target, {
  each: (node, index, frag) => {
    // add a class based on the index
    node.classList.add(`number-${index}`)

    // add a transition delay based on the index
    node.style.transitionDelay = `${index * .05}s`
  }
})

element

A tag name that is used to create the wrapper element for each piece of the text after it is split using the delimeter.

const divs = splitter(target, { element: 'div' })

License

MIT. © 2018 Michael Cavalea

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].