0.18.1 • Published 8 months ago

@bolttech/atoms-side-menu v0.18.1

Weekly downloads
-
License
-
Repository
-
Last release
8 months ago

SideMenu Component

The SideMenu component is a React component designed to provide a customizable side menu navigation. This component allows users to select different menu items, which can trigger various actions.

Table of Contents

Installation

To use the SideMenu component in your React application, follow these steps:

Installation

npm install @bolttech/frontend-foundations @bolttech/atoms-side-menu

or

yarn add @bolttech/frontend-foundations @bolttech/atoms-side-menu

Once you have the required dependencies installed, you can start using the SideMenu component in your React application.

Props

The SideMenu component accepts the following props:

PropTypeDescription
dataTestIdstringThe data-testid attribute for testing purposes.
variantlight or darkProperty that will define the style of the side menu.
selectedstringThe value of the submenu that should be active.
itemsArrayA list of the menus that should be displayed on the side menu.

The MenuItem type consists of a set of attributes that will define the menus

PropTypeDescription
valuestringThe value of the Menu Item that will be used to return when clicked.
labelstringThe label to be displayed on the Menu item.
iconstringThe icon to be displayed on a Menu Header.
notificationsstringA string that is shown as a badge on the side of a leaf
onClickfunctionA function that should run on clicking on the specified menu item.
itemsArrayA list of the sub-menus that should be displayed as children of this menu.

Example

Here's an example of using the SideMenu component:

const [selected, setSelected] = useState('');

<SideMenu
  selected={selected}
  variant={variant}
  dataTestId="side-menu"
  items={[
    {
      label: 'Menu 1.1',
      onClick: setSelected,
      value: 'menu1.1',
    },
    {
      label: 'Menu 1.2',
      items: [
        {
          label: 'Menu 1.2.1',
          onClick: setSelected,
          value: 'menu1.2.1',
        },
        {
          label: 'Menu 1.2.2',
          icon: 'subscriptions',
          items: [
            {
              label: 'Menu 1.2.2.1',
              onClick: setSelected,
              value: 'menu1.2.2.1',
            },
            {
              label: 'Menu 1.2.2.2',
              onClick: setSelected,
              value: 'menu1.2.2.2',
            },
          ],
        },
      ],
    },
    {
      label: 'Menu 1.3',
      onClick: setSelected,
      value: 'menu1.3',
    },
    {
      label: 'Menu 1.4',
      onClick: setSelected,
      value: 'menu1.4',
    },
  ]}
/>;

Contributing

Contributions to the SideMenu component are welcome. If you find any issues or have suggestions for improvements, please feel free to open an issue or submit a pull request on the project's Bitbucket repository.

0.18.1

8 months ago

0.17.2

10 months ago

0.17.3

8 months ago

0.15.0

11 months ago

0.16.0

11 months ago

0.17.0

11 months ago

0.18.0

8 months ago

0.17.1

11 months ago

0.14.0

1 year ago

0.13.1

2 years ago

0.0.1

2 years ago

0.10.0

2 years ago

0.3.0

2 years ago

0.11.0

2 years ago

0.9.0

2 years ago

0.12.0

2 years ago

0.8.0

2 years ago

0.13.0

2 years ago

0.12.1

2 years ago

0.5.0

2 years ago

0.4.0

2 years ago

0.7.0

2 years ago

0.6.0

2 years ago

0.2.4

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.1

2 years ago

0.1.2

2 years ago

0.2.0

2 years ago

0.1.3

2 years ago

0.1.1

3 years ago

0.1.0

3 years ago