Popover
Popover is used to display content in an overlay that can be triggered by a button.
Anchor to propertiesProperties
- Anchor to blockSizeblockSizeSizeUnitsOrAuto
Adjust the block size.
- Anchor to inlineSizeinlineSizeSizeUnitsOrAuto
Adjust the inline size.
- Anchor to maxBlockSizemaxBlockSizeSizeUnitsOrNone
Adjust the maximum block size.
- Anchor to maxInlineSizemaxInlineSizeSizeUnitsOrNone
Adjust the maximum inline size.
- Anchor to minBlockSizeminBlockSizeSizeUnits
Adjust the minimum block size.
- Anchor to minInlineSizeminInlineSizeSizeUnits
Adjust the minimum inline size.
Popover
- __@overlayActivator@5652
HTMLElement
- __@overlayCommand@5650
(command: "--auto" | "--show" | "--hide" | "--toggle" | "--copy") => void
- __@overlayHidden@5651
boolean
- adoptedCallback
() => void
- attributeChangedCallback
(name: string) => void
- blockSize
Adjust the block size.
SizeUnitsOrAuto
- click
Like the standard `element.click()`, but you can influence the behavior with a `sourceEvent`. For example, if the `sourceEvent` was a middle click, or has particular keys held down, components will attempt to produce the desired behavior on links, such as opening the page in the background tab.
({ sourceEvent }?: ClickOptions) => void
- connectedCallback
() => void
- disconnectedCallback
() => void
- inlineSize
Adjust the inline size.
SizeUnitsOrAuto
- maxBlockSize
Adjust the maximum block size.
SizeUnitsOrNone
- maxInlineSize
Adjust the maximum inline size.
SizeUnitsOrNone
- minBlockSize
Adjust the minimum block size.
SizeUnits
- minInlineSize
Adjust the minimum inline size.
SizeUnits
- queueRender
Queue a run of the render function. You shouldn't need to call this manually - it should be handled by changes to @property values.
() => void
- setAttribute
(name: string, value: string) => void
declare class Popover
extends PreactPopoverElement<typeof tagName$q>
implements PopoverProps
{
constructor();
}
SizeUnitsOrAuto
SizeUnits | 'auto'
SizeUnits
`${number}px` | `${number}%` | `0`
SizeUnitsOrNone
SizeUnits | 'none'
ClickOptions
- sourceEvent
The event you want to influence the synthetic click.
ActivationEventEsque
export interface ClickOptions {
/**
* The event you want to influence the synthetic click.
*/
sourceEvent?: ActivationEventEsque;
}
ActivationEventEsque
- button
number
- ctrlKey
boolean
- metaKey
boolean
- shiftKey
boolean
export interface ActivationEventEsque {
shiftKey: boolean;
metaKey: boolean;
ctrlKey: boolean;
button: number;
}
Anchor to eventsEvents
Learn more about registering events.
- Anchor to afterhideafterhideCallbackEventListener<TTagName> | null
- Anchor to aftershowaftershowCallbackEventListener<TTagName> | null
- Anchor to aftertoggleaftertoggleCallbackEventListener<TTagName> | null
- Anchor to hidehideCallbackEventListener<TTagName> | null
- Anchor to showshowCallbackEventListener<TTagName> | null
- Anchor to toggletoggleCallbackEventListener<TTagName> | null
PopoverEvents
- afterhide
CallbackEventListener<TTagName> | null
- aftershow
CallbackEventListener<TTagName> | null
- aftertoggle
CallbackEventListener<TTagName> | null
- hide
CallbackEventListener<TTagName> | null
- show
CallbackEventListener<TTagName> | null
- toggle
CallbackEventListener<TTagName> | null
export interface PopoverEvents {
show: CallbackEventListener<TTagName> | null;
hide: CallbackEventListener<TTagName> | null;
aftershow: CallbackEventListener<TTagName> | null;
afterhide: CallbackEventListener<TTagName> | null;
toggle: CallbackEventListener<TTagName> | null;
aftertoggle: CallbackEventListener<TTagName> | null;
}
CallbackEventListener
(EventListener & {
(event: CallbackEvent<T>): void;
}) | null
CallbackEvent
Event & {
currentTarget: HTMLElementTagNameMap[T];
}
Code
examples
Code
<s-button commandFor="product-options-popover">Product options</s-button> <s-popover id="product-options-popover" accessibilityLabel="Product options"> <s-stack direction="column" gap="small-500" padding="small-200 small-300"> <s-button variant="tertiary">Import</s-button> <s-button variant="tertiary">Export</s-button> </s-stack> </s-popover>
<!DOCTYPE html><html><head><style>html, body {height:100%} body {box-sizing: border-box; margin: 0; padding:0.5rem; display: grid; place-items: start center; gap: 0.5rem;}</style><script src="https://cdn.shopify.com/shopifycloud/app-bridge-ui-experimental.js"></script></head><body><div><s-button commandFor="product-options-popover">Product options</s-button> <s-popover id="product-options-popover" accessibilityLabel="Product options"> <s-stack direction="column" gap="small-500" padding="small-200 small-300"> <s-button variant="tertiary">Import</s-button> <s-button variant="tertiary">Export</s-button> </s-stack> </s-popover> </div></body></html>