Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including stimulus-uppercaseable-input with all npm packages installed. Try it out:

var stimulusUppercaseableInput = require("stimulus-uppercaseable-input")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

stimulus-uppercaseable-input v1.0.6

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

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.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free