![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
react-easy-edit
Advanced tools
A React library that allows inline editing on HTML5 input components, try the sandbox here!
For full library documentation, visit this site!
input
(most types, even inputs with datalist
), textarea
,radio
, checkbox
and select
HTML typesnpm i react-easy-edit
or yarn add react-easy-edit
Give a :star: if this project helped you in any way!
For the full list of props, please visit our documentation.
More examples can be found here
import React, { Component } from 'react';
import EasyEdit from 'react-easy-edit';
function App() {
const save = (value) => {alert(value)}
const cancel = () => {alert("Cancelled")}
return (
<EasyEdit
type="text"
onSave={save}
onCancel={cancel}
saveButtonLabel="Save Me"
cancelButtonLabel="Cancel Me"
attributes={{ name: "awesome-input", id: 1}}
instructions="Star this repo!"
/>
);
}
<EasyEdit
type="radio"
value="one"
onSave={save}
options={[
{label: 'First option', value: 'one'},
{label: 'Second option', value: 'two'}]}
instructions="Custom instructions"
/>
<EasyEdit
type="date"
onSave={save}
instructions="Select your date of birth"
/>
<EasyEdit
type="select"
options={[
{label: 'First option', value: 'one'},
{label: 'Second option', value: 'two'}]}
onSave={save}
placeholder="My Placeholder"
instructions="Custom instructions"
/>
<EasyEdit
type="datalist"
options={[
{label: 'First option', value: 'one'},
{label: 'Second option', value: 'two'}]}
onSave={save}
instructions="Custom instructions"
/>
<EasyEdit
type="checkbox"
options={[
{label: 'First option', value: 'one'},
{label: 'Second option', value: 'two'}]}
onSave={save}
value={['one', 'two']} // this will preselect both options
/>
When using custom input components, they must be passed in as props, like so:
<EasyEdit
type="text"
onSave={() => {}}
editComponent={<CustomInput />}
displayComponent={<CustomDisplay />}
/>
When defining a custom input component, the function setParentValue
is injected into your custom component, which must be called in order to pass the desired value up to the parent EasyEdit
component.
For example, if your component was a text field that needed to set the EasyEdit
value as a user id based on a username entered, you would need to pass the id to this.props.setParentValue
in order to get that value to the EasyEdit
component.
e.g.
// Inside your custom input
onChange(searchTerm) {
getUserIdByUsername(searchTerm).then((userId) => {
this.props.setParentValue(userId);
})
}
You can use a custom EditComponent and still use the saveOnBlur behavior. An onBlur
function will be passed to your custom component, for you to trigger the behavior.
class CustomComponent extends React.Component{
constructor(props){
super(props);
}
render(){
return <div>
<p>Custom editor</p>
<input onBlur={this.props.onBlur} />
</diV>;
}
}
Contributions, issues and feature requests are welcome.
Feel free to check issues page if you want to contribute.
For transparency and insight into our release cycle, releases will be numbered with the following format:
<major>.<minor>.<patch>
And constructed with the following guidelines:
Copyright © 2020 George Artemiou.
This project is MIT licensed.
FAQs
A react library for inline editing components
The npm package react-easy-edit receives a total of 0 weekly downloads. As such, react-easy-edit popularity was classified as not popular.
We found that react-easy-edit demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.