Skip to content

SPopover <s-popover> ​

開くためのボタンに固定して表示されるフローティングコンテンツ。 SPopover は、Shopify Polaris の <s-popover> web component 向けの型付き Vue 3 wrapper です。

ts
import { SPopover } from 'polaris-vue-elements'

ベストプラクティス ​

  • 二次的なコンテンツに使う。 ポップオーバーはマーチャントが開くまで隠れているため、すぐに見る必要があるものではなく、重要度の低い情報やアクションを置きます。
  • 関連するアクションをまとめる。 ポップオーバー内のアクションは、互いに関連するものにします。
  • わかりやすいラベルのボタンから開く。 中身を示すラベルを付けた、デフォルトまたは variant="tertiary" の SButton でポップオーバーを開きます。

詳しいガイダンスについては、<s-popover> に関する Shopify のベストプラクティス(英語)を参照してください。

例 ​

Toggle popoverPopover content, opened via commandFor/command on the button above.
vue
<script setup>
import { SButton, SPopover, SText } from 'polaris-vue-elements'
</script>

<template>
  <!-- Same declarative pattern as SModal: a trigger button's commandFor points
       at the popover's id, command controls the action ("--toggle" here). -->
  <SButton commandFor="example-popover" command="--toggle">Toggle popover</SButton>

  <SPopover id="example-popover">
    <SText>Popover content, opened via commandFor/command on the button above.</SText>
  </SPopover>
</template>

Props ​

Prop型説明
blockSize"auto" | "0"ブロックサイズを調整します。
inlineSize"auto" | "0"インラインサイズを調整します。
maxBlockSize"none" | "0"最大ブロックサイズを調整します。
maxInlineSize"none" | "0"最大インラインサイズを調整します。
minBlockSize"0"最小ブロックサイズを調整します。
minInlineSize"0"最小インラインサイズを調整します。

Events ​

Event型
afterhideCustomEvent
aftershowCustomEvent
aftertoggleEvent
hideCustomEvent
showCustomEvent
toggleEvent

これらのイベントは <SPopover> 上で @afterhide 形式のリスナーで受け取れます。

Slots ​

Slot説明
defaultポップオーバー内に表示されるコンテンツです。ポップオーバーはトリガー要素を基準に配置されるオーバーレイとして表示されます。通常、メニュー、アクションリスト、補足情報などを含みます。

MIT ライセンスの下で公開されています。Vue ロゴは Evan You によるもの(CC BY-NC-SA 4.0)。