react-multi-email
Advanced tools
Comparing version
@@ -1,2 +0,1 @@ | ||
/// <reference types="react" /> | ||
import * as React from 'react'; | ||
@@ -3,0 +2,0 @@ export interface IReactMultiEmailProps { |
@@ -1,2 +0,1 @@ | ||
/// <reference types="react" /> | ||
import * as React from 'react'; | ||
@@ -3,0 +2,0 @@ export interface IReactMultiEmailProps { |
{ | ||
"name": "react-multi-email", | ||
"version": "0.3.5", | ||
"version": "0.3.6", | ||
"description": "React multi email input", | ||
@@ -10,3 +10,3 @@ "jsnext:main": "es6/index.js", | ||
"license": "MIT", | ||
"dependencies": { | ||
"peerDependencies": { | ||
"react": "^16.3.2", | ||
@@ -13,0 +13,0 @@ "react-dom": "^16.3.2" |
@@ -5,6 +5,6 @@ # react-multi-email | ||
- Simple code | ||
- No dependency | ||
- Small size | ||
- Simple customization | ||
* Simple code | ||
* No dependency | ||
* Small size | ||
* Simple customization | ||
@@ -15,3 +15,2 @@ [See Demo](http://react-multi-email.axisj.com/) | ||
## Installation | ||
@@ -25,3 +24,3 @@ | ||
```jsx | ||
```typescript jsx | ||
import * as React from 'react'; | ||
@@ -31,3 +30,7 @@ import { ReactMultiEmail } from 'react-multi-email'; | ||
class Basic extends React.Component { | ||
interface IProps {} | ||
interface IState { | ||
emails: string[]; | ||
} | ||
class Basic extends React.Component<IProps, IState> { | ||
state = { | ||
@@ -39,37 +42,29 @@ emails: [], | ||
const { emails } = this.state; | ||
const myStyle = {}; | ||
return ( | ||
<> | ||
<Segment> | ||
<Form> | ||
<Form.Field> | ||
<label>Email</label> | ||
<ReactMultiEmail | ||
style={myStyle} | ||
emails={emails} | ||
onChange={_emails => { | ||
this.setState({ emails: _emails }); | ||
}} | ||
getLabel={( | ||
email, | ||
index, | ||
removeEmail, | ||
) => { | ||
return ( | ||
<Label key={index}> | ||
{email} | ||
<Icon name="delete" onClick={() => removeEmail(index)} /> | ||
</Label> | ||
); | ||
}} | ||
/> | ||
</Form.Field> | ||
<Form.Field> | ||
<label>react-multi-email value</label> | ||
{emails.join(', ') || 'empty'} | ||
</Form.Field> | ||
</Form> | ||
</Segment> | ||
<h3>Email</h3> | ||
<ReactMultiEmail | ||
emails={emails} | ||
onChange={(_emails: string[]) => { | ||
this.setState({ emails: _emails }); | ||
}} | ||
getLabel={( | ||
email: string, | ||
index: number, | ||
removeEmail: (index: number) => void, | ||
) => { | ||
return ( | ||
<div data-tag key={index}> | ||
{email} | ||
<span data-tag-handle onClick={() => removeEmail(index)}> | ||
× | ||
</span> | ||
</div> | ||
); | ||
}} | ||
/> | ||
<br /> | ||
<h4>react-multi-email value</h4> | ||
<p>{emails.join(', ') || 'empty'}</p> | ||
</> | ||
@@ -79,2 +74,4 @@ ); | ||
} | ||
export default Basic; | ||
``` | ||
@@ -86,3 +83,2 @@ | ||
> If you don't mind, don't forget to press "star" before leaving. |
Sorry, the diff of this file is not supported yet
25059
1.84%634
3.76%78
-4.88%- Removed
- Removed