https://github.com/bendrucker/email-input
Email input component for virtual-dom
https://github.com/bendrucker/email-input
Last synced: over 1 year ago
JSON representation
Email input component for virtual-dom
- Host: GitHub
- URL: https://github.com/bendrucker/email-input
- Owner: bendrucker
- License: mit
- Created: 2015-07-31T01:13:10.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2018-11-13T19:07:13.000Z (over 7 years ago)
- Last Synced: 2025-04-10T08:13:59.706Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 9.77 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# email-input [](https://travis-ci.org/bendrucker/email-input)
> Email input component for virtual-dom
## Install
```
$ npm install --save email-input
```
## Usage
```js
var EmailInput = require('email-input')
var emailInput = EmailInput()
function render (state) {
var vtree = EmailInput.render(state)
//=> use virtual-dom to patch vtree into real DOM
}
emailInput(render)
```
## API
#### `EmailInput(data)` -> `function`
Create a new email input observable.
##### data
Type: `object`
The initial state of the input.
###### value
Type: `string`
The email address.
#### `EmailInput.validate(state)` -> `boolean`
Validate the email input state.
#### `EmailInput.render(state, options)` -> `object`
Render an email state to a vtree object. `options` will be merged with the defaults (`{type: 'email', name: 'email'}`) and passed to [virtual-hyperscript](https://github.com/Matt-Esch/virtual-dom/tree/master/virtual-hyperscript).
## License
MIT © [Ben Drucker](http://bendrucker.me)