0.0.1 • Published 5 years ago

react-priority-navigation_v2 v0.0.1

Weekly downloads
6
License
MIT
Repository
github
Last release
5 years ago

PriorityNav for React

Example

import PriorityNav, { ToggleButton } from 'react-priority-navigation';

<PriorityNav
  icon={props => (
    <ToggleButton {...props}>
      <Icon />
    </ToggleButton>
  )}
  dropdownList={children => (
    <CustomDropdown>
      {children.map(item => <CustomItem>{item}</CustomItem>)}
    </CustomDropdown>
  )}
>
  <button>I am a Button ⏹ ️</button>
  <a>This is Link 🔗</a>
  <div>I am a Div!</div>
  <div>Looooong Div🐢🐢🐢🐢</div>
  <div>🉑</div>
</PriorityNav>;

Props

NameTypeDescriptionDefault
itemPaddingStringPadding of each children'unset'
minWidthStringMin width of the nav'250px'
offsetNumberExtra width to trigger0
debounceNumberDebounce0
placement'left', 'right', 'top', 'bottom', 'topLeft', 'topRight', 'bottomRight', 'bottomLeft';Placement of the dropdown'bottomRight'
isOpenBooleanDropdown open statefalse
icon(props: IconSetting) => React.ReactElementUse this to render custom Icon with ToggleButtonnull
dropdownList(item: Array<React.ReactNode>) => React.ReactElementcustom dropdown, take children as propsnull

ToggleButton

  color?: string;
  size?: number;
  hoverColor?: string;
  children?: React.ReactNode

IconSetting

  color: string;
  size: number;
  hoverColor: string;