Skip to content

michal-worwag/fit-my-text

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Summary

A package that allows you to adjust the text to the width of the container. Decreases or increases the font size to fit the text in the container.

Install via NPM

  npm install fit-my-text

Usage

  import fitMyText from 'fit-my-text';

  fitMyText(element, options);

Options

Option Default Description
element querySelector for element (required)
min 16 The minimum font size in pixels
max 512 The maximum font size in pixels
selectorType single Defines if you use single element or multiple elements (may be 'single' or 'multiple')

Options object

{
  min: 16,
  max: 512,
  selectorType: 'single'
}