npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

oms-ui-floating-menu

v1.1.6

Published

Airtour framework Package

Downloads

414

Readme

Floating Menu

If you work with big project's that is composed of many sub-projects, you need tool that link you to specific sub-project from another one. in FloatingMenu package we give you this ability to have connection with your sub-projects.

Table of Contents

Demo

Screenshot

Installation

$ npm install oms-ui-floating-menu
$ yarn add oms-ui-floating-menu

Usage

For use FloatingMenu component in your project

  • You need to give a state to open prop and set it false in onClose prop with setOpen.
  • After that you must give array to items of IFloatingItem type that must have object with icon, name, color, link, show properties.
<FloatingMenu
  open={open}
  items={[
    {
      icon: <Layers />,
      name: "Page 1",
      color: "#A82C56",
      link: "",
      show: true,
    },
    {
      icon: <Layers />,
      name: "Page 2",
      color: "#028888",
      link: "",
      show: true,
    },
  ]}
  onClose={() => setOpen(false)}
/>

Props

disablePortal?: boolean;

FloatingMenu by default use createPortal method to mounted component beside the body tag. if you want to prevent the portal to mounted in DOM where the component is used, add disablePortal prop to component.

open: boolean;

As you might guess it open is for to understand FloatingMenu when should be opened.

items: IFloatingMenuProps[];

Its the main prop that this component has it. with items you can defined array of buttons that clickable, and when you click it send you to link that is deticated to. every item of items give a name, color to set backgroundColor for it, icon, link and show if you want to that item not visible currently.

Basic

IFloatingMenuProps is type that inherited of FloatingItem component props type

interface IFloatingItemProps
  extends IFloatingItem,
    React.HTMLAttributes<HTMLLIElement> {
  color: string;
}

and extends from IFloatingItem interface.

interface IFloatingItem {
  name: string;
  color: string;
  icon: React.SVGProps<SVGSVGElement>;
  link: string;
  show?: boolean;
}

anchor?: { x: (string | number), y: (string | number) };

With this one you can give position to component on x and y axises from top-left of page.

  • when you increase x value, Floating Menu make distance from top of the page
  • and increasing y make Floating Menu farther from left and closer to right of the page.

onClose: () => void;

It's for handling the state that you control the open prop with it and for example you can set it false to unmount component.

onClick?: (link: string) => void;

Give you a clicked item's link in onClick callback.

Contribute

If you have a feature request, please add it as an issue or make a pull request.

v0.2.6

  • Support disablePortal prop for cancel render component in body tag in DOM.

v0.2.9

  • Change FloatingItem component's base tag from <li> to <a> (for new tab option in context menu).

License

Copyright (c) 2021 Airtour