You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

react-inline-autocomplete

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-inline-autocomplete

react-inline-autocomplete

1.0.5
latest
Source
npmnpm
Version published
Weekly downloads
613
156.49%
Maintainers
1
Weekly downloads
 
Created
Source

React Inline Autocomplete

version download license

Installation

yarn add react-inline-autocomplete

or

npm install react-inline-autocomplete --save

Remember to import react-inline-autocomplete/dist/index.css to your project.

Demo

Live demo: Protal

How to use

import InlineAutocomplete from 'react-inline-autocomplete';
import { DataSourceItem } from 'react-inline-autocomplete/dist';
import 'react-inline-autocomplete/dist/index.css';

const dataSource: DataSourceItem[] = [
  {
    text: 'Amazon',
    value: 'Amazon',
  },
  {
    text: 'Google',
    value: 'Google',
  },
  {
    text: 'Google Search',
    value: 'GoogleSearch',
  },
  {
    text: 'Apple',
    value: 'Apple',
  },
  {
    text: 'Apple Pencil',
    value: 'ApplePencil',
  },
  {
    text: 'Apple Watch',
    value: 'AppleWatch',
  },
  {
    text: 'Apple Power',
    value: 'ApplePower',
  },
];

function App() {
  const ref = React.createRef<HTMLInputElement>();
  const focus = () => {
    ref.current!.focus();
  };
  const onChange = (value: string) => {};
  const onPressEnter = (value: string) => {};
  const onSelect = (item: DataSourceItem) => {};

  return (
    <InlineAutocomplete
      ref={ref}
      className="inline-autocomplete-example"
      dataSource={dataSource}
      caseSensitive={false}
      onChange={onChange}
      onConfirm={onPressEnter}
      onSelect={onSelect}
    ></InlineAutocomplete>
  );
}

Props

PropertyTypeDefaultRequiredDescription
valuestringundefinednoinput value
dataSourceDataSourceItem[]yesArray of available items to search.
classNamestring""yes
styleReact.CSSPropertiesundefinedno
placeholderstringundefinedno
disabledbooleanfalsenoWhether to disable, the default is false.
caseSensitivebooleantrueno
navigatebooleantruenoYou can switch auto-complete when navigate is true.
onBlur() => voidundefinednoonBlur handler
onFocus() => voidundefinednoonFocus handler
onChange(value: string) => voidundefinednoonChange handler
onPressEnter(value: string) => voidundefinednoonPressEnter handler(called when you press Enter)
onSelect(item: DataSourceItem) => voidundefinednoonSelect handler(called when you press Tab)

Development

yarn
yarn dev
cd example
yarn
yarn start

Open http://localhost:3000.

Build & Publish

yarn
yarn build
npm publish
cd example
yarn
yarn build
cd ..
yarn deploy

License

MIT

Keywords

react

FAQs

Package last updated on 10 Oct 2020

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.