@highlight-ui/menu
TypeScript icon, indicating that this package has built-in type declarations

4.5.4 • Public • Published

npm personio.design storybook.personio.design

@highlight-ui/menu

Using npm:

npm install @highlight-ui/menu

Using yarn:

yarn add @highlight-ui/menu

Using pnpm:

pnpm install @highlight-ui/menu

In your (S)CSS file:

@import url('@highlight-ui/menu');

Once the package is installed, you can import the library:

import { Menu } from '@highlight-ui/menu';

Usage

import React, { useState } from 'react';
import { Menu } from '@highlight-ui/menu';

export default function MenuExample() {
  return (
    <Menu
      items={[
        { key: '1', title: 'Section 1' },
        { key: '2', title: 'Section 2' },
        {
          key: '3',
          title:
            'Section 3 with a really long text that gets truncated with an ellipsis at the end',
          disabled: true,
        },
      ]}
      onClick={handleOnClick}
    />
  );
}

Props 📜

Prop Type Required Default Description
items ListItem[] Yes List of objects of type ListItem
onClick (item: ListItem) => void Yes Sets clicked item to the active and returns item
variant "default", "anchor"" No default Applies anchor menu style
dragProps DragProps<ListItem, D> No Configuration for drag-and-drop capabilities
accessibilityProps NavAccessibilityProps No Sets accessibility props for the nav container
disableAutoActiveFirstItem boolean No false Should the first item be active by default
metadata ComponentMetadata No null Object used for testing. Contains testId and actionName.

Custom types 🔠

Type Values Description
ListItem "ListItem" props Used in the items prop
DragProps Provided by the drag-and-drop utility package Used in the dragProps prop
NavAccessibilityProps "NavAccessibilityProps" props Used in the accessibilityProps prop

Contributing 🖌️

Please visit personio.design for usage guidelines and visual examples.

If you're interested in contributing, please visit our contribution page.

Readme

Keywords

none

Package Sidebar

Install

npm i @highlight-ui/menu

Weekly Downloads

574

Version

4.5.4

License

MIT

Unpacked Size

88.5 kB

Total Files

17

Last publish

Collaborators

  • kbpersonio
  • ante.zebic
  • mislav_lukac_personio_ext
  • cusero
  • jordan-personio
  • personio-npm-ci
  • riain-personio
  • amadeofrompersonio
  • yunxi-yang
  • andresfrompersonio