0.4.0 • Published 8 years ago

ractive-autosize-input v0.4.0

Weekly downloads
3
License
ISC
Repository
github
Last release
8 years ago

#ractive-autosize-input

A clean and simple input component that calculates the needed width of the containing text and sizes itself accordingly.

Demo

Live Demo

Install

npm install ractive-autosize-input --save

Usage

Add the component to your Ractive instance:

new Ractive({
    ...
    components: {
        'autosize-input': require('ractive-autosize-input')
    },
    ...
});

Use it

<autosize-input value='Hello!'/>
<autosize-input placeholder='Secret phrase' value='{{.phrase}}'
                on-change='...'
                on-keypress='...'
                on-keydown='...'/>

You can style the component just like a regular input. The class 'ractive-autosize-input' is added to the input as well as any classes on the class property on the instance:

<autosize-input value='Hello!' class='donkey balls'/>

Plays well with max-width and min-width as well

<autosize-input value='Hello!' style='max-width: 80px; min-width: 30px;'/>

API

TODO. Stewardess telling me to close my laptop. :(

Future?

Maybe make it work with textareas if there's demand for it

Contributing

Open to PRs and stuff. I'm around.

0.4.0

8 years ago

0.3.1

10 years ago

0.3.0

10 years ago

0.2.5

10 years ago

0.2.3

10 years ago

0.2.2

10 years ago

0.2.1

10 years ago

0.2.0

10 years ago

0.1.0

10 years ago