1.0.4 • Published 2 years ago

@carusox/hyphenator v1.0.4

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

Hyphenator

Hyphenation does not correctly work in all devices and browsers. This library will let you hyphenate text via JS. Hyphenation provided by this library is far from perfect, but good enough for most usecases.

For now we provide a single hook called useSoftHyphenation.

This hook will only add hyphens to words than don't fit the viewport, since our target are really long words (probably autogenerated or something). It will also recalculate the correct hyphens when the element resizes. Keep in mind this does hyphenates anywhere on the word.

This hook receives the reference of the element, and the text that you want to display in it.

You can see it in action in this codesandbox.

We also provide SoftHyphenatedText which is a simple span that uses the hook explained before.

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago