JSPM

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

Package Exports

  • react-adaptive-text

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-adaptive-text) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

AdaptiveText React component

Simple UI component that allows the font size of a text to adapt automatically to fill the width of an element in one line.

AdaptiveText render example

Prerequisites

  • react >= 16.8.0

Install

npm install --save react-adaptive-text

Usage example

import React from 'react';
import AdaptiveText from 'react-adaptive-text';

function BasicExample = () => {
  const wrapperStyle = {
    display: 'flex',
    justifyContent: 'center',
    width: 500,
  };

  return (
    <div style={wrapperStyle}>
      <AdaptiveText
        width="80%"
        text="This text fills 80% width of its container!"
      />
    </div>
  );
};

Options

Property Type Description
color (Optional) CSS value Overrides color inheritance
fontFamily (Optional) CSS value Overrides font-family inheritance
fontSizeMax (Optional) integer Maximum font size (in pixels)
fontSizeMin (Optional) integer Minimum font size (in pixels)
fontStyle (Optional) CSS value Overrides font-style inheritance
fontWeight (Optional) CSS value Overrides font-weight inheritance
text string Text to display
textDecoration (Optional) CSS value Overrides text-decoration inheritance
width (Optional) CSS value Overrides width inheritance (default: 100%)