JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 150374
  • Score
    100M100P100Q166499F
  • License MIT

Better text wrapping.

Package Exports

  • react-wrap-balancer
  • react-wrap-balancer/dist/index.js
  • react-wrap-balancer/dist/index.mjs

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-wrap-balancer) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

React Wrap Balancer

One simple component to make your titles more elegant:

Notice that in “Balanced Title Wrapping” above, every line of wrapped text has almost the same width, so it will likely not to have one single word in a line.

Usage

Install it to your React project:

npm i react-wrap-balancer

And wrap any text with it:

import { Balancer } from 'react-wrap-balancer'

// ...

function Title() {
  return (
    <h1>
      <Balancer>My Awesome Title</Balancer>
    </h1>
  )
}

Requirements

This library uses browser and React 18 APIs such as:

  • ResizeObserver
  • Symbol.for
  • useId() hook

License

MIT.