MenuItemWithDrop

Type: React component

How to get MenuItemWithDrop?

JavaScript

import { MenuItemWithDrop } from 'fds/components';

A MenuItem variant which adds the ability to open and close a drop. This component only standardizes the behavior of opening and closing the drop, the actual contents can be specified using a render function.

Closing the outer drop or the drop rendered for this menu item is done automatically by any descendant MenuItem or MenuItemWithDrop. If you render anything else inside the drop and want to close the outer drop or the drop rendered for this menu item, use the provided closeOuterDrop callback inside the "props" of this component's renderDrop.

When providing an "onClick" property, the item will split itself in two parts: a clickable part and a part used for opening the drop on hover. Both parts manage their own hover state.

Should be rendered inside a Menu or MenuGroup.

Props

  1. icon

    (Optional)

    Type: String

    The name of the icon displayed in the component.

    This should be one of the FontAwesome (v5 Pro) icon names with an optional style prefix ('far ' is the default prefix). For more info, see the Font Awesome concept page.

    Default value

  2. isDisabled

    (Optional)

    Type: Boolean

    Whether or not the component should be rendered in a disabled state.

    Default value

  3. isHovered

    (Optional)

    Type: Boolean

    Whether or not the component is currently hovered.

    Default value

  4. isSelected

    (Optional)

    Type: Boolean

    Whether or not the component should be rendered in a selected state.

    Default value

  5. keyBindingLabel

    (Optional)

    Type: String

    The human readable label indicating a key binding (shortcut) displayed in the component.

    Default value

  6. label

    (Optional)

    Type: String

    The human readable label displayed in the component.

    Default value

  7. onClick

    (Optional)

    Type: Function

    A callback that is called whenever the component is clicked and is not in a disabled state.

    For more information about React and "events", check the React documentation

    Arguments

    Default value

  8. onMouseEnter

    (Optional)

    Type: Function

    A callback that is called whenever the pointer is moved over the component. This callback is only fired when the pointer enters the component.

    For more information about React and "events", check the React documentation

    Arguments

    Default value

  9. onMouseLeave

    (Optional)

    Type: Function

    A callback that is called whenever the pointer is moved off the component. This callback is only fired when the pointer leaves the component.

    For more information about React and "events", check the React documentation

    Arguments

    Default value

  10. renderDrop

    (Required)

    Type: Function

    A callback that is called at every render of this component. Expects a valid React component instance of the desired drop and its contents to be returned.

    Arguments

    Returns

  11. tooltipContent

    (Optional)

    Type: String | ReactElement

    The content of the tooltip that is displayed when hovering over the whole component.

    • string: the textual content of the tooltip

    • ReactElement: a React Element (instance of a React Component, usually created with JSX)

    Default value

  12. rendererName

    (Required)

    Default value