npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@3mo/number-fields

v0.0.11

Published

Web components for number, percent and currency fields that format and parse values in the user's locale.

Readme

Number Fields

Web components for number, percent and currency fields that format and parse values in the user's locale.

npm Documentation

mo-field-number — A field for a number, formatted in the user's language and clamped to min and max when committed.

mo-field-currency — A number field for an amount of money, showing the currency's symbol at the end.

mo-field-percent — A number field for a percentage, from 0 to 100 unless min and max say otherwise, with a percent sign at the end.

Installation

npm install @3mo/number-fields
import '@3mo/number-fields'

Usage

<mo-field-number label='Quantity' value='1'></mo-field-number>

Examples

  • Range — A value outside min and max is clamped when it is committed - type 80 and leave the field.
  • Formatting — The value is formatted in the page's language - switch it in the toolbar to see the separators change.
  • Slots — start and end hold icons or units beside the number.
  • States — Required, read-only, disabled and dense.

Currency Field

  • Default
  • Currencies — currency takes an ISO 4217 code and shows its symbol; without one no symbol is shown.

Percent Field

  • Default
  • Range — The value is clamped to 0-100 when committed - type 150 and leave the field.
  • Percent Sign — percentSign replaces the sign shown at the end.

API

mo-field-number

Properties

| Name | Attribute | Type | Default | Description | | --- | --- | --- | --- | --- | | min | min | number \| undefined | | The minimum value of the field. | | max | max | number \| undefined | | The maximum value of the field. | | step | step | number \| undefined | | The step value of the field. | | selectOnFocus | selectOnFocus | true | true | Selects the input text when the field receives focus. | | dense | dense | boolean | false | Whether the field is dense | | value | value | number \| undefined | | The value of the field. | | label | label | string | "" | The field's label | | readonly | readonly | boolean | false | Whether the field is readonly | | disabled | disabled | boolean | false | Whether the field is disabled | | required | required | boolean | false | Whether the field is required |

Events

| Name | Detail | Description | | --- | --- | --- | | change | T \| undefined | Dispatched with the value when the user commits it | | input | T \| undefined | Dispatched with the value while the user edits it | | validityChange | boolean | Dispatched with whether the value is valid, after every validation |

Slots

| Name | Description | | --- | --- | | (default) | The field's content | | start | Content to be placed at the start of the field | | end | Content to be placed at the end of the field |

CSS parts

| Name | Description | | --- | --- | | input | The input element. | | container | Field's container |

mo-field-currency

Properties

| Name | Attribute | Type | Default | Description | | --- | --- | --- | --- | --- | | currency | currency | Currency \| undefined | "defaultCurrency" | The currency of the field. | | min | min | number \| undefined | | The minimum value of the field. | | max | max | number \| undefined | | The maximum value of the field. | | step | step | number \| undefined | | The step value of the field. | | selectOnFocus | selectOnFocus | true | true | Selects the input text when the field receives focus. | | dense | dense | boolean | false | Whether the field is dense | | value | value | number \| undefined | | The value of the field. | | label | label | string | "" | The field's label | | readonly | readonly | boolean | false | Whether the field is readonly | | disabled | disabled | boolean | false | Whether the field is disabled | | required | required | boolean | false | Whether the field is required |

Events

| Name | Detail | Description | | --- | --- | --- | | change | T \| undefined | Dispatched with the value when the user commits it | | input | T \| undefined | Dispatched with the value while the user edits it | | validityChange | boolean | Dispatched with whether the value is valid, after every validation |

Slots

| Name | Description | | --- | --- | | (default) | The field's content | | start | Content to be placed at the start of the field | | end | Content to be placed at the end of the field |

CSS parts

| Name | Description | | --- | --- | | input | The input element. | | container | Field's container |

mo-field-percent

Properties

| Name | Attribute | Type | Default | Description | | --- | --- | --- | --- | --- | | percentSign | percentSign | string | "%" | The percent sign of the field. | | min | min | number | 0 | The minimum value of the field. | | max | max | number | 100 | The maximum value of the field. | | step | step | number \| undefined | | The step value of the field. | | selectOnFocus | selectOnFocus | true | true | Selects the input text when the field receives focus. | | dense | dense | boolean | false | Whether the field is dense | | value | value | number \| undefined | | The value of the field. | | label | label | string | "" | The field's label | | readonly | readonly | boolean | false | Whether the field is readonly | | disabled | disabled | boolean | false | Whether the field is disabled | | required | required | boolean | false | Whether the field is required |

Events

| Name | Detail | Description | | --- | --- | --- | | change | T \| undefined | Dispatched with the value when the user commits it | | input | T \| undefined | Dispatched with the value while the user edits it | | validityChange | boolean | Dispatched with whether the value is valid, after every validation |

Slots

| Name | Description | | --- | --- | | (default) | The field's content | | start | Content to be placed at the start of the field | | end | Content to be placed at the end of the field |

CSS parts

| Name | Description | | --- | --- | | input | The input element. | | container | Field's container |

Links

License

MIT © 3MO GmbH