Socket
Socket
Sign inDemoInstall

@paprika/dropdown-menu

Package Overview
Dependencies
110
Maintainers
5
Versions
79
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @paprika/dropdown-menu

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.


Version published
Weekly downloads
544
decreased by-16.56%
Maintainers
5
Created
Weekly downloads
 

Readme

Source

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

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.SIMPLE]falseTrigger.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>;
  • Storybook showcase
  • Github source code
  • Github create issue
  • ChangeLog

FAQs

Last updated on 29 Oct 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc