stimulus-uppercaseable-input

@1.0.6 by Stephen Dolan

A StimulusJS controller for forcing any input field to uppercase only.

Score: 3.6

npm codebeat badge

Stimulus Uppercaseable Input

This is a simple StimulusJS controller that forces any element that emits an input event to allow only uppercase letters.

JSFiddle Demo.

Install

This assumes that StimulusJS is already installed.

Add the stimulus-uppercaseable-input module:

$ yarn add stimulus-uppercaseable-input

or

$ npm install stimulus-uppercaseable-input

Basic Usage

First, register the controller with StimulusJS:

// application.js
import { Application } from 'stimulus';
import { UppercaseableInput } from 'stimulus-uppercaseable-input';

const application = Application.start();
application.register("uppercaseable-input", UppercaseableInput);

Next, you need an input element that emits an input event to attach the controller to:

<form>
    <input data-controller="uppercaseable-input" type="text" />
</form>

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/stephendolan/stimulus-uppercaseable-input. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

This package is available as open source under the terms of the MIT License.