yuai-autocomplete
v0.0.3
Published
React autocomplete components with styled-components
Downloads
6
Maintainers
Readme
yuai-autocomplete
React autocomplete components with styled-components
Install
yarn install yuai-autocomplete react styled-components
Components
Autocomplete
import * as React from 'react';
import styled from 'styled-components';
import { Autocomplete, Option } from 'yuai-Autocomplete';
const StyledAutocomplete = styled(Autocomplete)`
.yuai-autocomplete-input {
padding: 10px 25px 10px 15px;
font-size: 17px;
width: 100%;
border-radius: 3px 0 0 3px;
}
`;
const HelloWorld = () => {
const [ value, setValue ] = React.useState<Option | null>(null);
const onSearch = (keyword) => getOption(keyword);
const onChange = (selectedOption: Option | null) => setValue(selectedOption);
return (
<StyledAutocomplete
required
onSearch={onSearch}
onChange={onChange}
/>
);
};
License
MIT