https://github.com/bendrucker/copy-input
Render an input that auto-selects and copies when clicked
https://github.com/bendrucker/copy-input
Last synced: about 1 year ago
JSON representation
Render an input that auto-selects and copies when clicked
- Host: GitHub
- URL: https://github.com/bendrucker/copy-input
- Owner: bendrucker
- License: mit
- Created: 2015-11-18T14:34:36.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2018-11-13T18:58:20.000Z (over 7 years ago)
- Last Synced: 2024-11-18T19:15:35.193Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 6.84 KB
- Stars: 4
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# copy-input [](https://travis-ci.org/bendrucker/copy-input)
> Render an input that auto-selects and copies when clicked
## Install
```
$ npm install --save copy-input
```
## Usage
```js
var CopyInput = require('copy-input')
var state = CopyInput()
var options = {
style: {
background: 'blue'
},
value: 'copy me!'
}
CopyInput.render(state, options)
//=> ...
//=> renders blue readonly input that copies itself when clicked
```
## API
#### `CopyInput()` -> `function`
Returns an observable value representation (`state`).
#### `CopyInput.render(state, options)` -> `object`
Renders the copy input to a vtree. `options.value` is displayed in the input field.
## License
MIT © [Ben Drucker](http://bendrucker.me)