woocommerce/plugins/woocommerce-admin/client/components/search
Kelly Dwan d36511479e Docs Project: Add documentation parser + inline documentation (https://github.com/woocommerce/woocommerce-admin/pull/336)
* Switch all components to default exports

This ensures we can read all components for documentation generation (plus, standardizing is good)

* Add documentation to component file

* Fix table exports

* Move readme docs into inline docs

Includes updating new props, adding prop shapes

* Add doc-generation scripts to pull exported component docs into folder

* Remove key propType, causing react special-keys warning

* Fix proptype

* Update incorrect comment

* Remove template import, we can just use string concat

* Fix typo, update docs
2018-08-31 13:27:21 -04:00
..
autocompleters Components: Add a search component based on Autocomplete (https://github.com/woocommerce/woocommerce-admin/pull/322) 2018-08-28 15:15:24 -04:00
README.md Components: Add a search component based on Autocomplete (https://github.com/woocommerce/woocommerce-admin/pull/322) 2018-08-28 15:15:24 -04:00
autocomplete.js Components: Add a search component based on Autocomplete (https://github.com/woocommerce/woocommerce-admin/pull/322) 2018-08-28 15:15:24 -04:00
index.js Docs Project: Add documentation parser + inline documentation (https://github.com/woocommerce/woocommerce-admin/pull/336) 2018-08-31 13:27:21 -04:00
style.scss Components: Add a search component based on Autocomplete (https://github.com/woocommerce/woocommerce-admin/pull/322) 2018-08-28 15:15:24 -04:00

README.md

Search

A search box which autocompletes results while typing, allowing for the user to select an existing object (product, order, customer, etc). Currently only products are supported.

Usage

import { Search } from '@woocommerce/components';

class MySearchBox extends Component {
	updateLocalValue( results ) {
		// Do whatever with results.
	}
	render() {
		return (
			<Search type="products" onChange={ this.updateLocalValue } />
		);
	}
}
  • onChange: Function called when selected results change, passed result list.
  • type (required): Which object type to search, can be one of customers, orders, or products.