react-simple-horizontal-menu
TypeScript icon, indicating that this package has built-in type declarations

1.0.14 • Public • Published

React-simple-horizontal-menu

Simplest React horizontal menu library.

Features

  • React menu components for easy and fast web development.
  • Support Right-To-Left smooth scrool.
  • Low bundle size with fantastic performance.
  • Flexible menu positioning.
  • Easy styling and customisation.

Install

with npm

npm i react-simple-horizontal-menu

with yarn

yarn add react-simple-horizontal-menu

usage

import React, { useState } from 'react';
import { HorizontalMenu } from 'react-simple-horizontal-menu';
import '../../node_modules/react-simple-horizontal-menu/dist/styles/core.css';

const items = [...Array(100)].map((_, i) => {
  return {
    id: i,
    label: `No. ${i}`,
  };
});

export default function Test() {
  const [id, setId] = useState(0);

  const onChange = (_id: number) => {
    setId(_id);
  };

  const getLabel = items.find((item) => item.id === id)?.label ?? null;

  return (
    <div>
      dd
      <HorizontalMenu items={items} onChange={onChange} rtl={true} />
      <div
        style={{
          marginTop: '16px',
          display: 'flex',
          width: '100%',
          justifyContent: 'center',
        }}
      >
        Selected value: {getLabel}
      </div>
    </div>
  );
}

API

Licence

MIT @ devinoue

Package Sidebar

Install

npm i react-simple-horizontal-menu

Weekly Downloads

1

Version

1.0.14

License

MIT

Unpacked Size

39.5 kB

Total Files

12

Last publish

Collaborators

  • devinoue