1.2.0 • Published 11 months ago

multi-levels-popper v1.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

multi-levels-popper

Made with create-react-library

NPM JavaScript Style Guide

This component will help you create nested poppers.

Install

npm install --save multi-levels-popper

Usage

In this example, we use Tippy.js(recommend) to display popper, you can use other libraries.

import { MultiLevelsPopper } from 'multi-levels-popper'

const MyComponent = () => {
  return (
    <Tippy
      interactive
      placement='right-start'
      render={(attrs) => (
        <MultiLevelsPopper>
          <SettingPopper />
        </MultiLevelsPopper>
      )}
    >
      <button style={{ position: 'absolute', top: '200px', left: '200px' }}>
        My button
      </button>
    </Tippy>
  )
}

Customized Popper

import { Popper, PopperItem } from 'multi-levels-popper'

const SettingPopper = () => {
  return (
    <Popper>
      <PopperItem>
        <div>Setting 1</div>
      </PopperItem>
      <PopperItem childPopper={<ChildPopper />}>
        <div>Setting 2</div>
      </PopperItem>
      <PopperItem>
        <div>Setting 3</div>
      </PopperItem>
    </Popper>
  )
}

When you click on PopperItem which has childPopper prop, it will display the child popper.

MultiLevelsPopper Props

PropDescriptionRequired
childrenThe first level popper.
darkSwitch to dark theme.

Popper Props

PropDescriptionRequired
titlePopper's header title.
maxHeigthThis will enable vertical scroll bar. Example: maxHeight='200px'
classNameYou can pass className from parent.

PopperItem Props

PropDescriptionRequired
childPopperChild popper(next level popper). Example: childPopper={<ChildPopper />}

License

MIT © huahoangphuc4201

1.2.0

11 months ago

1.1.0

11 months ago

1.0.9

11 months ago

1.0.1

11 months ago

1.0.8

11 months ago

1.0.7

11 months ago

1.0.6

11 months ago

1.0.5

11 months ago

1.0.4

11 months ago

1.0.3

11 months ago

1.0.2

11 months ago

1.0.0

11 months ago