Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

r-editable

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

r-editable

Simple editable field for React, supporting several input types

  • 0.1.6
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

#R-Editable x-editable-like component for React.

When clicked, a span element can turn into two editable fields.

##Input When clicked the field will be rendered as an input element, when unfocused or Enter pressed, the value will be keps in the component and passed to the onChange function.

const alertMsg = (msg)=> alert(msg)
<REditable value='Change me' onChange={alertMsg.bind(null,'You changed me!')}/>

##Dropdown When clicked the field will be rendered as a select element together with its received options props. When unfocused or Enter pressed, the value will be keps in the component and passed to the onChange function.

const myOpt = [
  {name:'Apple',value:'apple'},
  {name:'Pear',value:'pear'},
  {name:'Grape',value:'grape'},
  {name:'Banana',value:'banana'},
  {name:'Orange',value:'orange'}
]
<REditable type='dropdown' onChange={alertMsg.bind(null,'You changed dropdown')} options={myOpt} />

Note: no styling is provided by default, hence some basic CSS is suggested:

span.r-editable{
  font-size: 1em;
  width: auto;
  border-bottom: 2px dashed red;
}
input.r-editable{
  background: #C5F0DA;
  font-size: 1em;
  border: none;
  outline: none;
  width: auto;
  padding:0;
  margin:0;
}
select.r-editable{
  font-size: 1em;
  background: white;
}
div[id^='re-'] div.examples{
  margin-left: 2em;
}

###License ISC

FAQs

Package last updated on 11 Nov 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc