Skip to content

station-x/svg-text-wrap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

For when you have a target and you want your svg to wrap like html within that. (does not hyphen-ate)

Install

npm install svg-text-wrap

Usage

import textWrap from 'svg-text-wrap'

const text = "A really long string that you probably want to make fit"
const textArray = textWrap(text, 100, { 'letter-spacing': '1px' })

// textArray will look something like 
// [
//   "A really long string",
//   "that you probably",
//   "want to make fit"
// ]

see svg-text-size if you'd like to work with these dimensions.

About

Give a string, a desired width, and some svg style attributes, get back an array

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published