use-email-autocomplete
Advanced tools
Comparing version 1.0.4 to 1.0.5
{ | ||
"name": "use-email-autocomplete", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"homepage": "https://codepen.io/alex-cory/pen/daLjKj?editors=0010", | ||
@@ -5,0 +5,0 @@ "github": "https://github.com/alex-cory/use-email-autocomplete", |
@@ -37,3 +37,3 @@ # Email Autocomplete Hook | ||
This should work with all other libraries including `material-ui` and others. | ||
This should work with other libraries including `material-ui`. | ||
Play with it [here](https://alex-cory.github.io/email-autocomplete-input/)! | ||
@@ -64,4 +64,37 @@ | ||
Custom Autocomplete Input | ||
------------------------- | ||
```jsx | ||
export const EmailInput = ({ onChange, ...props }) => { | ||
const { email, onChange: handleEmailChange, bind } = useEmailAutocomplete() | ||
const handleChange = e => { | ||
handleEmailChange(e) | ||
onChange(email) | ||
} | ||
return <input {...bind} {...props} onChange={handleChange} value={email} /> | ||
} | ||
``` | ||
Usage with Material UI | ||
---------------------- | ||
Requires `@material-ui/core: 4.0.0` and above. | ||
```jsx | ||
import { TextField } from '@material-ui/core' | ||
export const EmailInput = ({ onChange, ...props }) => { | ||
const { email, onChange: handleEmailChange, bind } = useEmailAutocomplete() | ||
const handleChange = e => { | ||
handleEmailChange(e) | ||
onChange(email) | ||
} | ||
return <TextField {...bind} {...props} onChange={handleChange} value={email} /> | ||
} | ||
``` | ||
### Examples | ||
- Codesandbox (coming soon... codesandbox is messing up saying I have >50 sandboxes even though I don't...) | ||
- [Codesandbox](https://codesandbox.io/s/useemailautocomplete-material-ui-j5m1x) | ||
@@ -68,0 +101,0 @@ Options |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10726
122