@bearei/react-dropdown
TypeScript icon, indicating that this package has built-in type declarations

0.0.20 • Public • Published

react-dropdown

Base dropdown components that support React and React native

Installation

yarn add @bearei/react-dropdown --save

Parameters

Dropdown options

Name Type Required Description
visible boolean Dropdown visible state
event React.MouseEvent React.TouchEvent GestureResponderEvent Triggers an event when a dropdown option changes

Dropdown

Name Type Required Description
visible boolean Dropdown visible state
defaultVisible boolean The default visible state for the dropdown
menu MenuProps Dropdown menu props -- Menu
disabled boolean Whether or not to disable the dropdown
loading boolean Whether or not the dropdown is loading
onVisible (options: DropdownOptions) => void This function is called when the dropdown visible state changes
onClose (options: DropdownOptions) => void This function is called when the dropdown is closed
onClick (e: React.MouseEvent) => void This function is called when dropdown is clicked
onTouchEnd (e: React.TouchEvent) => void This function is called when the dropdown is pressed
onPress (e: GestureResponderEvent) => void This function is called when the dropdown is pressed -- react native
renderMain (props: DropdownMainProps) => ReactNode Render the dropdown main
renderContainer (props: props: DropdownContainerProps) => ReactNode Render the dropdown container

Use

import React from 'React';
import ReactDOM from 'react-dom';
import Dropdown from '@bearei/react-dropdown';

const dropdown = (
  <Dropdown
    renderMain={({ ...props }) => <div {...props}>"dropdown"</div>}
    renderContainer={({ id, content }) => (
      <div data-id={id} tabIndex={1}>
        {content}
      </div>
    )}
  />
);

ReactDOM.render(dropdown, container);

Package Sidebar

Install

npm i @bearei/react-dropdown

Weekly Downloads

2

Version

0.0.20

License

MIT

Unpacked Size

61.7 kB

Total Files

11

Last publish

Collaborators

  • bear_ei