Package Exports
- @hawk-ui/dropdown
- @hawk-ui/dropdown/dist/index.min.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@hawk-ui/dropdown) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Installation
To install a component run
$ npm install @hawk-ui/dropdown --save
Please import CSS styles via
@import '/path__to__node_modules/@hawk-ui/dropdown/dist/index.min.cssUsage
Dropdown Button Click
import Dropdown from '@hawk-ui/dropdown';const suggestions = [
{title: 'Action', value: 'action', isActive: true},
{title: 'Another action', value: 'another action', isActive: false},
{title: 'Something else here', value: 'something else here', isActive: true},
];
<Dropdown
title="Dropdown"
isIcon
isMultiClickable
suggestions={suggestions}
renderSuggestion={(suggestion) => suggestion.title}
selectValue={(meta, item) => { console.log(meta, item); }}
/>Dropdown With Children
import Dropdown from '@hawk-ui/dropdown';initialState = {
shouldDropdownShow: false,
};
const suggestions = [
{title: 'Action', value: 'action', isActive: true},
{title: 'Another action', value: 'another action', isActive: false},
{title: 'Something else here', value: 'something else here', isActive: true},
];
<Dropdown
title="Dropdown"
isIcon
suggestions={suggestions}
shouldDropdownShow={state.shouldDropdownShow}
renderSuggestion={(suggestion) => suggestion.title}
selectValue={(meta, item) => { console.log(meta, item); }}
children={(
<React.Fragment>
<span
onClick={() => {
setState({
shouldDropdownShow: false,
});
}}
>
Children Action
</span>
</React.Fragment>
)}
/>Dropdown Link
import Dropdown from '@hawk-ui/dropdown';const suggestions = [
{title: 'Action', value: 'action', link: '/#', isActive: true},
{title: 'Another action', value: 'another action', link: '/#', isActive: false},
{title: 'Something else here', value: 'something else here', link: '/#', isActive: true},
];
<Dropdown
title="Dropdown"
isIcon
suggestions={suggestions}
renderSuggestion={(suggestion) => suggestion.title}
selectValue={(meta, item) => { console.log(meta, item); }}
/>Dropdown Button Hover
import Dropdown from '@hawk-ui/dropdown';const suggestions = [
{title: 'Action', value: 'action'},
{title: 'Another action', value: 'another action'},
{title: 'Something else here', value: 'something else here'},
];
<Dropdown
title="Dropdown"
isIcon
isHoverable
suggestions={suggestions}
renderSuggestion={(suggestion) => suggestion.title}
selectValue={(meta, item) => { console.log(meta, item); }}
/>