1.0.7 • Published 5 months ago

react-morph-menu v1.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

React + Vite

React Morph Menu

react-morph-menu is a customizable navigation menu for React applications. This package provides an elegant and interactive menu indicator with dynamic behavior based on user interactions.

Demo Video

Watch the demo video showcasing how the react-morph-menu works:

Watch Video

Click on the image or here to watch the demo video.

Installation

Install the package using npm or yarn:

npm install react-morph-menu

or

yarn add react-morph-menu

Usage

Import the MorphMenu component into your React project:

import MorphMenu from "react-morph-menu/dist/MorphMenu";

const items = ["Home", "Profile", "Message", "Setting", "Photos"];

function App() {
  return (
    <MorphMenu
      indicatorShape={"circle"} // Customize the shape of the indicator
      items={items} // Array of menu items
    />
  );
}

export default App;

Props

Prop NameType Description
indicatorShapestring Shape of the indicator. See the table below for possible values.
itemsarray of strings Array of menu item names to display.

Items Options

The items input is necessary .

Indicator Shape Options

The indicatorShape prop determines the shape of the menu indicator. Possible values are: The indicatorShape input is necessary .

ValueDescription
circleDisplays the indicator as a circle.
circle-in-itemDisplays the indicator as a circle inside the active item.
triangleDisplays the indicator as a triangle.
rectangleDisplays the indicator as a rectangle.
rectangle-in-itemDisplays the indicator as a rectangle inside the active item.

Example

Here is a simple example using the MorphMenu component:

import MorphMenu from "react-morph-menu/dist/MorphMenu";

const items = ["Dashboard", "Settings", "Notifications", "Help"];

function App() {
  return (
    <MorphMenu
      indicatorShape={"triangle"} // Set the indicator shape to triangle
      items={items} // Pass your menu items
    />
  );
}

export default App;

Optional Styles

Prop NameTypeDescriptionDefault Value
indicatorWidthnumberThe width of the indicator in pixels.each shape has its own width
indicatorHeightnumberThe height of the indicator in pixels.each shape has its own height
indicatorTopnumberThe top position of the indicator, relative to the menu, in pixels.each shape has its own top
indicatorLeftnumberThe left position of the indicator, relative to the menu, in pixels.each shape has its own left
textColorstringThe text color of the menu items. Accepts any valid CSS color value.#fff
indicatorBgsrtingThe background color of the indicator. Accepts any valid CSS color value.#01193e
indicatorBorderColorstringThe border color of the indicator. Accepts any valid CSS color value.This input is used in circle and rectangle shape in #ffe4c4 color but it is better to choose its color according to the body background color

License

MIT

Keywords

Here are the relevant keywords to help others discover this package:

"keywords": "react", "react-component", "react-menu", "navigation-menu", "menu", "morph-menu", "interactive-menu", "customizable-menu", "ui-component", "react-ui", "responsive-menu", "dynamic-menu", "menu-indicator", "react-navigation"