Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

adaptable-text

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

adaptable-text

Adapt font size to a specified width.

  • 2.1.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

adaptable-text

styled with prettier

Adapt font size to a specified width.

Install

$ npm install --save adaptable-text

Usage

const textToAdapt = new AdaptableText(document.querySelector(".textToAdapt"), {
  step: 0.1,
  minFontSize: 10,
  width: null
});
textToAdapt.init();

// Adapt
const adapt = () => {
  textToAdapt.setWidth();
  textToAdapt.adapt();
};

// Listen for a resize event
window.addEventListener("resize", adapt);

// Kick off
requestIdleCallback(() => {
  adapt();
});
KeyDescription
stepThe step used by the generator to calculate the width of the element
minFontSizeA minimum font size for the element (max would be the size defined in a stylesheet retrieved by window.getComputedStyle(this.element))
widthA maximum widht for the container.

Scripts

Dev

npm run dev

Test

npm run test

Build

npm run build

License

MIT © Damien Seguin

Keywords

FAQs

Package last updated on 16 Feb 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc