Adds rows to your forms automagically ✨
Install
$ npm install --save magic-rows
Or download the minified version.
No dependencies.
Features
- ➡ Row appending automation — adds a row only when the two previous are filled
- ⛔ Maximum rows restriction — enables only a certain number of rows
- 🎩 Pattern detection — learns from your patterns to follow your style
- 📖 Pattern declaration — understands your rules to match better
Usage
Insert the script at the end of the body
:
Add data-action="magic-rows"
to your form
:
Play
That's it!
Options
You can change all the settings by adding the following data
attributes to your form
.
Attributes | Type | Default | Example | Description |
---|---|---|---|---|
data-max-rows |
integer |
6 |
3 |
Maximum number of rows |
data-format-id |
string |
"" |
player-$ |
Pattern to be applied to id s |
data-format-name |
string |
"" |
player_$$ |
Pattern to be applied to name s |
data-format-placeholder |
string |
"" |
Player @ |
Pattern to be applied to placeholder s |
Values declaration
$
will be interpreted as a number$$
will be interpreted as a 2-digit number (01
)$$$
will be interpreted as a 3-digit number (001
)- ...
@
will be interpreted as a letter
Examples
Pattern detection
Play
Will generate:
Pattern declaration
Send
Will generate:
Demo
See the demo folder.
License
MIT © François Chalifour