Socket
Book a DemoInstallSign in
Socket

react-auto-text

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-auto-text

A React component for autosizing text within a set container size

1.0.0
latest
Source
npmnpm
Version published
Weekly downloads
7
133.33%
Maintainers
1
Weekly downloads
 
Created
Source

react-auto-text

npm

AutoText is a React component that allows you to have dynamic text sizing to fit inside of a component with a set height.

Install

$ npm install --save react-auto-text

Usage

import React from 'react';
import AutoText from 'react-auto-text';

function MyComponent() {
  return (
    <AutoText
      maxHeight={200}
      maxFontSize={20}
      minFontSize={10}
      onChange={fontSize => console.log(fontSize)}>
        Bacon ipsum dolor amet filet mignon salami andouille corned beef.
    </AutoText>
  );
}

export default MyComponent;

API

<AutoText>

  • maxHeight (number) Max height of the container you wish to fill. Default 100
  • maxFontSize (number) Maximum font size in pixels. Default 20
  • minFontSize (number) Minimum font size in pixels. Default 10
  • onChange (function) Optional function called when text size changes.

License

MIT

Keywords

react

FAQs

Package last updated on 27 Mar 2017

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.