# @hig/menu

> HIG Menu

Latest version **2.2.3** (published 2022-12-08) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @hig/menu
pnpm add @hig/menu
yarn add @hig/menu
bun add @hig/menu
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.2.3 |
| Published | 2022-12-08 |
| First published | 2021-01-14 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 194.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 194 |
| Author | Autodesk Inc. |
| Maintainers | hig-bot, nfiniteset, wmui51, staceyshk |

## Links

- npm: https://www.npmjs.com/package/@hig/menu
- Repository: https://github.com/Autodesk/hig
- Homepage: https://github.com/Autodesk/hig#readme
- Issues: https://github.com/Autodesk/hig/issues
- npm.io page: https://npm.io/package/@hig/menu

## Dependencies (4)

- [@hig/icons](https://npm.io/package/@hig/icons.md) ^4.2.0
- [@hig/utils](https://npm.io/package/@hig/utils.md) ^0.4.1
- [prop-types](https://npm.io/package/prop-types.md) ^15.7.1
- [@hig/behaviors](https://npm.io/package/@hig/behaviors.md) ^2.1.0

## Recent versions

- 2.2.3 (latest) — 2022-12-08
- 2.2.2 — 2022-10-02
- 2.2.1 — 2022-09-12
- 2.2.0 — 2022-08-28
- 2.1.1 — 2022-02-07
- 2.1.0 — 2022-01-24
- 2.0.0 — 2022-01-13
- 1.3.3 — 2022-01-12
- 1.3.2 — 2022-01-12
- 1.3.1 — 2021-10-27
- 1.3.0 — 2021-09-01
- 1.2.0 — 2021-07-21
- 1.1.0 — 2021-05-25
- 1.0.0 — 2021-01-14

## README

# Menu

A menu is a mechanism to display a list of choices through interaction with a button, icon or other controls.

Read more about when and how to use the Menu component [on the internal wiki](https://hig.autodesk.com/web/components/menus).

## Getting started

### Install the package

```bash
yarn add @hig/menu @hig/theme-context @hig/theme-data
```

### Import the component

```js
import Menu from "@hig/menu";
```

## Basic usage

```jsx
<Menu>
  <Option>Option 1</Option>
  <Option>Option 2</Option>
  <Option>Option 3</Option>
</Menu>
```

## Customization

### Styling

Use the `className` prop to pass in a css class name to the outermost container of the component. The class name will also pass down to most of the other styled elements within the component.

Menu also has a `stylesheet` prop that accepts a function wherein you can modify Menu's styles. The original styles, props, current theme data and theme meta will be passed to your custom stylesheet function, and it should return an object with the same structure as the original styles. For instance

```jsx
function customStylesheet(styles, props, themeData) {
  return {
    ...styles,
    menuGroup: {
      ...styles.menuGroup,
      backgroundColor: "yellow"
    },
    menu: {
      ...styles.menu,
      backgroundColor: props.collapsed
        ? themeData["basics.colors.green100"]
        : themeData["basics.colors.darkBlue100"]
    },
    menuOption: {
      ...styles.menuOption,
      backgroundColor: props.collapsed
        ? themeData["basics.colors.green100"]
        : themeData["basics.colors.darkBlue100"]
    },
    checkmarkWrapper: {
      ...styles.checkmarkWrapper,
      backgroundColor: props.collapsed
        ? themeData["basics.colors.green100"]
        : themeData["basics.colors.darkBlue100"]
    },
    assetWrapper: {
      ...styles.assetWrapper,
      backgroundColor: props.collapsed
        ? themeData["basics.colors.green100"]
        : themeData["basics.colors.darkBlue100"]
    },
    optionContentWrapper: {
      ...styles.optionContentWrapper,
      backgroundColor: props.collapsed
        ? themeData["basics.colors.green100"]
        : themeData["basics.colors.darkBlue100"]
    },
    shortcutWrapper: {
      ...styles.shortcutWrapper,
      backgroundColor: props.collapsed
        ? themeData["basics.colors.green100"]
        : themeData["basics.colors.darkBlue100"]
    }
  };
}

<Menu stylesheet={customStylesheet}>
  <Option>Option 1</Option>
  <Option>Option 2</Option>
  <Option>Option 3</Option>
</Menu>
```

---
_Source: https://npm.io/package/@hig/menu · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
