2.0.48 • Published 5 years ago

@paprika/dropdown-menu v2.0.48

Weekly downloads
2,364
License
MIT
Repository
github
Last release
5 years ago

@paprika/dropdown-menu - 2.0.47-alpha.1

Description

DropdownMenu component displays a trigger button, which when clicked displays a list of items in a dropdown format. These items can be raw content, Links or actions such as Delete, which will prompt a confirmation panel to be displayed.

Installation

yarn add @paprika/dropdown-menu

or with npm:

npm install @paprika/dropdown-menu

Props

DropdownMenu

PropTyperequireddefaultDescription
aligncustomfalsePopover.defaultProps.alignAlignment of the Popover
childrennodetrue-Children should consist of <Dropdown.Item />
edgecustomfalsePopover.defaultProps.edgeIf provided, will align Popover to specified edge of Trigger
onClosecustomfalsePopover.defaultProps.onCloseIf provided, will fire when the Popover is closed
zIndexcustomfalsePopover.defaultProps.zIndexThe z-index for the popover / confirmation

DropdownMenu.Item

PropTyperequireddefaultDescription
childrennodetrue-HTML for each item
isDestructiveboolfalsefalseIf the item is destructive.
onClickfuncfalse() => {}Callback to be executed when button is clicked
onKeyDownfuncfalse() => {}Callback to be executed when key is pressed
onClosefuncfalse() => {}Callback to be executed when dropdown needs to be closed
onShowConfirmationfuncfalse() => {}Callback to be executed when delete item is clicked
renderConfirmationfuncfalsenullRender prop to render the replacement node

DropdownMenu.LinkItem

PropTyperequireddefaultDescription
childrennodetrue-HTML for each LinkItem
linkstringtrue-The url for the href
onKeyDownfuncfalse() => {}Callback to be executed when key is pressed
isExternalboolfalsefalseShould the link open content in a new tab

DropdownMenu.Trigger

PropTyperequireddefaultDescription
childrennodefalsenull
buttonType Trigger.types.button.ICON, Trigger.types.button.RAW, Trigger.types.button.SIMPLEfalseTrigger.types.button.SIMPLEDetermine the styling of the button
isOpenboolfalsefalse
menuRefIdstringfalse""
onOpenMenufuncfalse() => {}
triggerRefcustomfalsenull

Usage

import DropdownMenu from "@paprika/dropdown-menu";
import Confirmation from "@paprika/confirmation";

<DropdownMenu>
  <DropdownMenu.Trigger>Trigger</DropdownMenu.Trigger>
  <DropdownMenu.Content className="my-popover-classname" />
  <DropdownMenu.Item onClick={() => {}}>Edit</DropdownMenu.Item>
  <DropdownMenu.LinkItem isExternal link="http://www.wegalvanize.com">
    External link
  </DropdownMenu.LinkItem>
  <DropdownMenu.Item isDisabled onClick={() => {}}>
    Disabled Item
  </DropdownMenu.Item>
  <DropdownMenu.Divider />
  <DropdownMenu.Item
    isDestructive
    renderConfirmation={onCloseMenu => {
      return (
        <Confirmation
          body="Lorem ipsum dolor amet vexillologist tacos selvage narwhal butcher twee ethical hot chicken."
          confirmLabel="Delete filter"
          defaultIsOpen
          heading="Delete filter?"
          onConfirm={handleConfirm}
          onClose={handleCloseConfirm(onCloseMenu)}
        />
      );
    }}
  >
    Delete filter
  </DropdownMenu.Item>
</DropdownMenu>;

Links

2.0.48

5 years ago

2.0.47-alpha.5

5 years ago

2.0.47-alpha.4

5 years ago

2.0.47-alpha.3

5 years ago

2.0.47-alpha.2

5 years ago

2.0.47-alpha.1

5 years ago

2.0.47-alpha.0

5 years ago

2.0.46

5 years ago

2.0.45

5 years ago

2.0.44

5 years ago

2.0.43

5 years ago

2.0.42

5 years ago

2.0.41

5 years ago

2.0.40

5 years ago

2.0.39

5 years ago

2.0.38

5 years ago

2.0.37

5 years ago

2.0.36

5 years ago

2.0.35

5 years ago

2.0.34

5 years ago

2.0.33

5 years ago

2.0.32

5 years ago

2.0.31

5 years ago

2.0.30

5 years ago

2.0.29

5 years ago

2.0.28

5 years ago

2.0.27

5 years ago

2.0.26

5 years ago

2.0.25

5 years ago

2.0.24

5 years ago

2.0.23

5 years ago

2.0.22

5 years ago

2.0.21

5 years ago

2.0.20

5 years ago

2.0.19

5 years ago

2.0.18

5 years ago

2.0.17

5 years ago

2.0.16

5 years ago

2.0.15

5 years ago

2.0.14

5 years ago

2.0.13

5 years ago

2.0.12

5 years ago

2.0.11

5 years ago

2.0.10

5 years ago

2.0.9

5 years ago

2.0.8

5 years ago

2.0.7

5 years ago

2.0.6

5 years ago

2.0.5

5 years ago

2.0.4

5 years ago

2.0.3

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.1.5

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.12

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago