# fitted-text

> An element that horizontally squishes a line of text to a specific width.

Latest version **2.0.5** (published 2022-01-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install fitted-text
pnpm add fitted-text
yarn add fitted-text
bun add fitted-text
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.5 |
| Published | 2022-01-09 |
| First published | 2021-02-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 16.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | inkfarer |
| Maintainers | inkfarer |

## Links

- npm: https://www.npmjs.com/package/fitted-text
- Homepage: https://github.com/inkfarer/fitted-text
- npm.io page: https://npm.io/package/fitted-text

## Recent versions

- 2.0.5 (latest) — 2022-01-09
- 2.0.4 — 2022-01-08
- 2.0.3 — 2021-11-19
- 2.0.2 — 2021-11-19
- 2.0.1 — 2021-11-19
- 2.0.0 — 2021-09-17
- 1.0.1 — 2021-02-06
- 1.0.0 — 2021-02-06

## README

# fitted-text

Horizontally squishes a line of text down to a set limit.

Built to be a vanilla JS alternative to [sc-fitted-text](https://github.com/SupportClass/sc-fitted-text).

## Install & Usage

Install the package from npm: `npm i fitted-text`

Include the package in your HTML page: 
```html
<script src="/node_modules/fitted-text/dist/fitted-text.js"></script>
```

Use the element as follows:
```html
<fitted-text
	text="Text"
	max-width="100"
	align="right"
	id="fit-text">
</fitted-text>
```

The element's properties can be edited using JS as follows:

```js
document.getElementById('fit-text').text = 'Text set using JavaScript';
```

For the element to use HTML tags, use the `useInnerHTML` attribute:

```html
<fitted-text 
	text="<i>Text</i>"
	max-width="100"
	align="right"
	use-inner-html
	id="html-fit-text">
</fitted-text>
```

```js
document.getElementById('html-fit-text').useInnerHTML = true;
```

For a demonstration of all the element's capabilities, 
refer to the `example.html` file in the repository root.

---
_Source: https://npm.io/package/fitted-text · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
