Skip to content

Instantly share code, notes, and snippets.

@schnerd
Last active December 1, 2018 21:13
Show Gist options
  • Save schnerd/045ee729696f0352bb106b186eb50855 to your computer and use it in GitHub Desktop.
Save schnerd/045ee729696f0352bb106b186eb50855 to your computer and use it in GitHub Desktop.
// App.js
render() {
<Autocomplete
options={this.props.products}
overrides={{
Root: {
props: {'aria-label': 'Select an option'},
style: ({$isOpen}) => ({borderColor: $isOpen ? 'blue' : 'grey'}),
},
Option: {
component: CustomOption
}
}}
/>
}
// CustomOption.js
export default function CustomOption({onClick, $option}) {
return (
<div onClick={onClick}>
<h4>{$option.name}</h4>
<small>{$option.price}</small>
</div>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment