5.0.8 • Published 24 days ago

@leafygreen-ui/guide-cue v5.0.8

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
24 days ago

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

PropTypeDescriptionDefault
openbooleanDetermines if the Tooltip will appear as open or close.false
setOpenfunctionCallback to change the open state of the Tooltip.(boolean) => boolean
refElHTMLElementReference to an element that the tooltip should be positioned against.null
numberOfStepsnumberUsed 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
currentStepnumberUsed to display the current step. If numberOfSteps === 1 this number will not display.1
darkModebooleanDetermines whether the Tooltip will appear in dark mode.false
titlestringTitle to appear inside of Tooltip.''
childrenReact.ReactNodeBody content to appear inside the tooltip, under the title.''
buttonTextstringText 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'`
onDismissfunctionCallback fired when the dismiss(X) button is clicked or when the Esc key is pressed. This only applies to the multi-step tooltip.() => {}
onPrimaryButtonClickfunctionCallback fired when the bottom primary button is clicked. This applies to both the stand-alone and multi-step tooltip. This is also fired when the Esc key is pressed in the stand-alone tooltip.() => {}
tooltipClassNamestringClassName 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
portalContainerHTMLElement | nullSets the container used for the popover's portal. NOTE: If using a scrollContainer make sure that the portalContainer is contained within the scrollContainer. E.g, passing the same refrence to scrollContainer and portalContainer.
scrollContainerHTMLElement | nullIf 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.
portalClassNamestringPasses the given className to the popover's portal container if the default portal container is being used.
popoverZIndexnumberSets the z-index CSS property for the popover.
...native div attributesAny other props will be spread on the tooltip div element
5.0.8

24 days ago

5.0.7

1 month ago

5.0.6

2 months ago

5.0.6-popover.0

4 months ago

5.0.5

6 months ago

5.0.4

7 months ago

5.0.3

8 months ago

5.0.2

8 months ago

5.0.1

9 months ago

5.0.0

9 months ago

4.0.9

10 months ago

5.0.0-alpha.1

10 months ago

5.0.0-alpha.0

10 months ago

4.0.10

10 months ago

4.0.12

9 months ago

4.0.11

9 months ago

4.0.8

11 months ago

4.0.6-next.4

12 months ago

4.0.6-next.5

12 months ago

4.0.6-next.6

12 months ago

4.0.6-next.7

12 months ago

4.0.6-next.0

12 months ago

4.0.6-next.1

12 months ago

4.0.6-next.2

12 months ago

4.0.6-next.3

12 months ago

4.0.5

12 months ago

4.0.4

12 months ago

4.0.7

11 months ago

4.0.6

11 months ago

4.0.3

1 year ago

4.0.2

1 year ago

3.0.1

1 year ago

4.0.1

1 year ago

4.0.0

1 year ago

3.0.0

1 year ago

2.0.1

2 years ago

2.0.0

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago