0.0.3 • Published 5 years ago

yuai-autocomplete v0.0.3

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

yuai-autocomplete

Build Size PeerDependencies LatestVersion License

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