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.1
Source
npmnpm
Version published
Weekly downloads
502
60.9%
Maintainers
1
Weekly downloads
 
Created
Source

React Inline Autocomplete

npm version

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: 'Google',
    value: 'Google',
  },
  {
    text: 'Google Search',
    value: 'GoogleSearch',
  },
  {
    text: 'Apple',
    value: 'Apple',
  },
  {
    text: 'Apple Pencil',
    value: 'ApplePencil',
  },
  {
    text: 'Amazon',
    value: 'Amazon',
  },
  {
    text: 'Microsoft',
    value: 'Microsoft',
  },
];

function App() {
  const ref = React.createRef<HTMLInputElement>();
  const focus = () => {
    ref.current!.focus();
  };
  const onChange = () => {};
  const onConfirm = () => {};

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

Props

PropertyTypeDefaultRequiredDescription
valuestringundefinednoinput value
dataSourceDataSourceItem[]yesArray of available items to search.
classNamestring""yes
styleReact.CSSPropertiesundefinedno
placeholderstringundefinedno
disabledbooleanfalsenoWhether to disable, the default is false.
onBlur() => voidundefinednoonBlur handler
onChange(text: string) => void;undefinednoonChange handler
onFocus() => voidundefinednoonFocus handler
onConfirm(item: DataSourceItem) => voidundefinednoonConfirm handler(called when you press Enter)

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 03 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.