update-input-width

WebJar for update-input-width

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

update-input-width
Last Version

Last Version

1.1.1
Release Date

Release Date

Type

Type

jar
Description

Description

update-input-width
WebJar for update-input-width
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/wojtekmaj/update-input-width

Download update-input-width

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/update-input-width/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>update-input-width</artifactId>
    <version>1.1.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/update-input-width/
implementation 'org.webjars.npm:update-input-width:1.1.1'
// https://jarcasting.com/artifacts/org.webjars.npm/update-input-width/
implementation ("org.webjars.npm:update-input-width:1.1.1")
'org.webjars.npm:update-input-width:jar:1.1.1'
<dependency org="org.webjars.npm" name="update-input-width" rev="1.1.1">
  <artifact name="update-input-width" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='update-input-width', version='1.1.1')
)
libraryDependencies += "org.webjars.npm" % "update-input-width" % "1.1.1"
[org.webjars.npm/update-input-width "1.1.1"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

npm downloads CI dependencies dev dependencies tested with jest

Update-Input-Width

A function that given an input element, updates its width to fit its content.

tl;dr

  • Install by executing npm install update-input-width or yarn add update-input-width.
  • Import by adding import updateInputWidth from 'update-input-width'.
  • Pass input element to it. Forget.

User guide

updateInputWidth(element: HTMLInputElement)

A function that given an input element, updates its width to fit its content by setting inline width CSS property.

Sample result

42

Usage

import updateInputWidth from 'update-input-width';

or

import { updateInputWidth } from 'update-input-width';

getFontShorthand(element: HTMLElement)

A function that given HTML element returns font CSS shorthand property. Equal to Chrome-only code:

window.getComputedStyle(element).font

Sample result

"normal normal 600 normal 20px / 25px Arial, sans-serif"

Usage

import { getFontShorthand } from 'update-input-width';

measureText(text: string, font: string)

A function that given text and font CSS shorthand property returns text width in pixels.

Sample result

42

Usage

import { measureText } from 'update-input-width';

License

The MIT License.

Author

Wojciech Maj
[email protected]
http://wojtekmaj.pl

Versions

Version
1.1.1