Socket
Socket
Sign inDemoInstall

boundless-fitted-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

boundless-fitted-text

Fit given text inside a parent container, obeying implict and explicit constraints.


Version published
Weekly downloads
1
decreased by-50%
Maintainers
1
Weekly downloads
 
Created
Source

FittedText

This component can be useful in situations where an internationalized string is being placed into the UI and it's unclear if all variations of it will fit without excessive amounts of edge-case CSS. Ultimately, it's good at making sure what you put in doesn't overflow.

Installation

npm i boundless-fitted-text --save

Then use it like:

/** @jsx createElement */

import { createElement } from 'react';
import Button from 'boundless-button';
import FittedText from 'boundless-fitted-text';

export default () => (
    <div className='spread'>
        <Button className='tall-button'>
            <FittedText>Welcome</FittedText>
        </Button>
        <Button className='tall-button'>
            <FittedText>Добро пожаловать</FittedText>
        </Button>
        <Button className='tall-button'>
            <FittedText>Benvenuto</FittedText>
        </Button>
        <Button className='tall-button'>
            <FittedText>환영합니다</FittedText>
        </Button>
        <Button className='tall-button'>
            <FittedText>സ്വാഗതം</FittedText>
        </Button>
    </div>
);

FittedText can also just be directly used from the main Boundless library. This is recommended when you're getting started to avoid maintaining the package versions of several components:

npm i boundless --save

the ES6 import statement then becomes like:

import { FittedText } from 'boundless';

Props

Note: only top-level props are in the README, for the full list check out the website.

Required Props

There are no required props.

Optional Props

  • * · any React-supported attribute

    ExpectsDefault Value
    anyn/a
  • component · any valid HTML tag name

    ExpectsDefault Value
    string'span'
  • upscale · controls if FittedText will automatically scale up the content to fit the available space; normally the component only scales text down as needed to fit

    ExpectsDefault Value
    boolfalse

Reference Styles

Stylus

You can see what variables are available to override in variables.styl.

// Redefine any variables as desired, e.g:
color-accent = royalblue

// Bring in the component styles; they will be autoconfigured based on the above
@require "node_modules/boundless-fitted-text/style"

CSS

If desired, a precompiled plain CSS stylesheet is available for customization at /build/style.css, based on Boundless's default variables.

Keywords

FAQs

Package last updated on 06 Jun 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

  • 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