moonstone/ Contextual Popup Decorator
A higher-order component to add a Moonstone styled popup to a component.
import ContextualPopupDecorator from '@enact/moonstone/ContextualPopupDecorator';Members
ContextualPopupDecoratorHigher-Order Component
Adds support for positioning a ContextualPopup relative to the wrapped component.
ContextualPopupDecorator may be used to show additional settings or actions rendered within a
small floating popup.
Usage:
const ButtonWithPopup = ContextualPopupDecorator(Button);
<ButtonWithPopup
direction="up"
open={this.state.open}
popupComponent={CustomPopupComponent}
>
Open Popup
</ButtonWithPopup>import ContextualPopupDecorator from '@enact/moonstone/ContextualPopupDecorator';Configuration
ContextualPopupwithout the arrow.Default: falseDisables passing the
skinprop to the wrapped component.Default: falseThe prop in which to pass the value of
openstate of ContextualPopupDecorator to the wrapped component.Default: 'selected'
Properties added to wrapped component
The component rendered within the ContextualPopup.
Limits the range of voice control to the popup.
Default: trueDirection of popup with respect to the wrapped component.
Default: 'down'Disables closing the popup when the user presses the cancel/back (e.g.
ESC) key or taps outside the popup.Default: falseCalled when the user has attempted to close the popup.
This may occur either when the close button is clicked or when spotlight focus moves outside the boundary of the popup. Setting
spotlightRestrictto'self-only'will prevent Spotlight focus from leaving the popup.Called when the popup is opened.
Displays the contextual popup.
Default: falseCSS class name to pass to the ContextualPopup.
This is commonly used to set width and height of the popup.
An object containing properties to be passed to popup component.
The container ID to use with Spotlight.
The spotlight container for the popup isn't created until it is open. To configure the container using
Spotlight.set(), handle theonOpenevent which is fired after the popup has been created and opened.Shows the close button.
Default: falseThe current skin for this component.
When
noSkinis set on the config object,skinwill only be applied to the ContextualPopup and not to the popup's activator component.Restricts or prioritizes spotlight navigation.
Allowed values are:
'none'- Spotlight can move freely within and beyond the popup'self-first'- Spotlight should prefer components within the popup over components beyond the popup, or'self-only'- Spotlight can only be set within the popup
Default: 'self-first'
Methods added to wrapped component
ContextualPopupComponent
A popup component used by ContextualPopupDecorator to wrap its popupComponent.
ContextualPopup is usually not used directly but is made available for unique application use
cases.
import {ContextualPopup} from '@enact/moonstone/ContextualPopupDecorator';Properties
The contents of the popup.
Style object for arrow position.
Style object for container position.
Called with the reference to the container node.
Direction of ContextualPopup.
Can be one of:
'up','down','left', or'right'.Default: 'down'Called when the close button is clicked.
Shows the arrow.
Default: falseShows the close button.
Default: false