modern-now

Back

Inputs

Intro

Improve your forms with simple, yet powerful, elements

Autogrowing textareas

Add data-autogrow to your textarea. Add data-trim to trim value automatically

Toggle Password

Add data-password on a checkbox to toggle its corresponding field.


Toggle checkboxes

Tick a checkbox to show new options! Set data-toggle="id_of_fieldset". Clear values when hiding by setting data-toggle-clear.

Limited inputs

Limit what can be set in the input with data-limited. You can specify multiple limitators using |.

Limit to lowercase with lower or to uppercase with upper. Entered characters are transformed as needed.

Limit to numerical values with numeric. Can be useful when you want to have a type=text (for example, when you allow values like 01) or to alpha values with alpha

Limit to a character range using regex. Any regex expression is valid.

Limit to a given mask using mask. Use 0-9 for numbers, a for letters and * for any. Others characters are added automatically.

For a more robust solution, use input-mask

For a more robust solution, use intl-tel-input

Bound inputs

Add data-to to send content to another element. Can be combined with limited inputs.

File uploads

Uploads are great, but dealing with large images is annoying. It's much better to let the browser deal with it. By default, images will fit in a 1920*1920 square. Simply add a data-resize attribute!

Input files are augmented with the following data attributes:

You can also use the data-resize attribute with a simple config string.

Please upload a file that is at least 512x512