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

@leafygreen-ui/guide-cue

v5.0.8

Published

leafyGreen UI Kit GuideCue

Downloads

135,439

Readme

GuideCue

npm (scoped)

View on MongoDB.design

Installation

Yarn

yarn add @leafygreen-ui/guide-cue

NPM

npm install @leafygreen-ui/guide-cue

Example

Stand-alone example

import { GuideCue } from '@leafygreen-ui/guide-cue';

const [open, setOpen] = useState(true);

<GuideCue
  open={open}
  setOpen={setOpen}
  title="New feature"
  refEl={triggerRef}
  numberOfSteps={1}
  currentStep={1}
  onPrimaryButtonClick={() => {
    // do something
  }}
>
  This is a new feature. You should try it out
</GuideCue>;

or

Multi-step example

import GuideCue from '@leafygreen-ui/guide-cue';

const [open, setOpen] = useState(true);

<GuideCue
  open={open}
  setOpen={setOpen}
  title="New feature"
  refEl={triggerRef}
  numberOfSteps={4}
  currentStep={2}
  onPrimaryButtonClick={() => {
    // do something
  }}
  onDismiss={() => {
    // do something
  }}
>
  This is a new feature. You should try it out
</GuideCue>;

An example of how to use the multi-step tooltip can be found in (storybook - MultistepDemo)[https://github.com/mongodb/leafygreen-ui/blob/main/packages/guide-cue/src/GuideCue.story.tsx]

Usage

There are two variations of the tooltip -- stand-alone and multi-step. The multi-step tooltip shows the number of steps, has a dismiss and primary button, and displays a pulsing beacon while the stand-alone tooltip only shows the primary button and does not include the number of steps or the dismiss button.

The variant that is shown depends on the number of steps. If numberOfSteps > 1 the multi-step tooltip is shown else the stand-alone tooltip is shown.

Properties

| Prop | Type | Description | Default | | ---------------------- | ---------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------- | | open | boolean | Determines if the Tooltip will appear as open or close. | false | | setOpen | function | Callback to change the open state of the Tooltip. | (boolean) => boolean | | refEl | HTMLElement | Reference to an element that the tooltip should be positioned against. | null | | numberOfSteps | number | Used to determine which tooltip will be shown. If numberOfSteps > 1 then the multi-step tooltip will be shown else the stand-alone tooltip will be shown. This number will only be displayed in the multi-step tooltip. | 1 | | currentStep | number | Used to display the current step. If numberOfSteps === 1 this number will not display. | 1 | | darkMode | boolean | Determines whether the Tooltip will appear in dark mode. | false | | title | string | Title to appear inside of Tooltip. | '' | | children | React.ReactNode | Body content to appear inside the tooltip, under the title. | '' | | buttonText | string | Text to appear inside the primary button. The default text for the stand-alone tooltip is Got it. The default text for the multi-step tooltip varies on the numberOfSteps and currentStep. If numberOfSteps === currentStep the text is Got it else it is Next. | 'Next' | |onDismiss |function | Callback fired when the dismiss(X) button is clicked or when theEsckey is pressed. This only applies to the multi-step tooltip. |() => {} | |onPrimaryButtonClick|function | Callback fired when the bottom primary button is clicked. This applies to both the stand-alone and multi-step tooltip. This is also fired when theEsckey is pressed in the stand-alone tooltip. |() => {} | |tooltipClassName |string | ClassName to be applied to the tooltip element. |'' | |tooltipAlign |'top'\|'bottom'\|'left'\|'right' | Determines the alignment of the tooltip. |top | |tooltipJustify |'start'\|'middle'\|'end' | Determines the justification of the tooltip. |middle | |beaconAlign |'top'\|'bottom'\|'left'\|'right'\|'center-horizontal'\|'center-vertical'| Determines the alignment of the beacon(animated pulsing circle that appears on top of the trigger element). This only applies to the multi-step tooltip. |center-horizontal | |portalContainer |HTMLElement\|null | Sets the container used for the popover's portal. NOTE: If using ascrollContainermake sure that theportalContaineris contained within thescrollContainer. E.g, passing the same refrence to scrollContainerandportalContainer. | | | scrollContainer |HTMLElement\|null | If the popover portal has a scrollable ancestor other than the window, this prop allows passing a reference to that element to allow the portal to position properly. | | |portalClassName |string | Passes the given className to the popover's portal container if the default portal container is being used. | | |popoverZIndex |number | Sets the z-index CSS property for the popover. | | | ... | nativedivattributes | Any other props will be spread on the tooltipdiv` element | |