1.0.4 • Published 1 month ago

@leafygreen-ui/info-sprinkle v1.0.4

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
1 month ago

Info Sprinkle

npm (scoped)

View on MongoDB.design

Installation

Yarn

yarn add @leafygreen-ui/info-sprinkle

NPM

npm install @leafygreen-ui/info-sprinkle

Example

import { InfoSprinkle } from `@leafygreen-ui/info-sprinkle`;

<InfoSprinkle>I'm an info sprinkle</InfoSprinkle>

Properties

PropTypeDescriptionDefault
childrenstringString that will be rendered inside of <InfoSprinkle />
openbooleanControls the component, and determines whether or not the <InfoSprinkle /> will appear open or closed.false
setOpenfunctionIf controlling the component, pass state handling function to setOpen prop. This will keep the consuming application's state in-sync with LeafyGreen's state, while the <InfoSprinkle /> component responds to events such as backdrop clicks and a user pressing the Escape key.(boolean) => boolean
shouldClosefunctionCallback that should return a boolean that determines whether or not the <InfoSprinkle /> should close when a user tries to close it.() => true
align'top', 'bottom', 'left', 'right'Determines the preferred alignment of the <InfoSprinkle /> component relative to the element passed to the trigger prop.'top'
justify'start', 'middle', 'end', 'fit'Determines the preferred justification of the <InfoSprinkle /> component (based on the alignment) relative to the element passed to the trigger prop.'start'
darkModebooleanDetermines if the <InfoSprinkle /> will appear in dark mode.false
idstringid applied to <InfoSprinkle /> component
classNamestringApplies a className to Tooltip container
triggerAriaLabelstringaria-label for the trigger iconmore info
enabledbooleanEnables Tooltip to trigger.true
onClosefunctionCallback that is called when the tooltip is closed internally. E.g. on ESC press, on backdrop click, on blur..() => {}
usePortalbooleanDetermines if the Tooltip will be rendered within a portal.true
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 lement 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.
baseFontSize13 | 16font-size applied to typography elementdefault to value set by LeafyGreen Provider
...native div attributesAny other props will be spread on the tooltip element

Note: The ref of this component will be the trigger icon but all props will spread to the internal <Tooltip/> component.