From fd140145be9f09804a7c92184e50fcf2545e9bdb Mon Sep 17 00:00:00 2001 From: Csaba Tuncsik Date: Mon, 1 Dec 2025 11:19:24 +0200 Subject: [PATCH] docs: Add component specification and usage examples for N8nPopover (#22433) Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .../components/Popover/component-popover.md | 217 ++++++++++++++++++ 1 file changed, 217 insertions(+) create mode 100644 packages/frontend/@n8n/design-system/src/v2/components/Popover/component-popover.md diff --git a/packages/frontend/@n8n/design-system/src/v2/components/Popover/component-popover.md b/packages/frontend/@n8n/design-system/src/v2/components/Popover/component-popover.md new file mode 100644 index 00000000000..76f75df8e5f --- /dev/null +++ b/packages/frontend/@n8n/design-system/src/v2/components/Popover/component-popover.md @@ -0,0 +1,217 @@ +# Component specification + +Displays floating content anchored to a trigger element. Popovers are used for dropdown menus, form overlays, and contextual actions that require more space than a tooltip. + +- **Component Name:** N8nPopover +- **Figma Component:** [Figma](https://www.figma.com/design/8zib7Trf2D2CHYXrEGPHkg/n8n-Design-System-V3?node-id=252-3284&m=dev) +- **Element+ Component:** [ElPopover](https://element-plus.org/en-US/component/popover.html) +- **Reka UI Component:** [Popover](https://reka-ui.com/docs/components/popover) +- **Nuxt UI Component:** [Popover](https://ui.nuxt.com/docs/components/popover) + +## Public API Definition + +**Props** + +- `visible?: boolean` - Controlled visibility state. Supports two-way binding via `v-model:visible`. +- `trigger?: 'click' | 'hover'` - How to trigger the popover. Default: `'click'` +- `placement?: Placement` - Position of popover relative to trigger. Values: `'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end' | 'right' | 'right-start' | 'right-end'`. Default: `'bottom'` +- `width?: string | number` - Popover width. Can be a number (pixels) or string (e.g., `'auto'`, `'304px'`). +- `contentClass?: string` - Custom CSS class name for the popover content element. +- `contentStyle?: CSSProperties` - Inline styles object for the popover content element. +- `teleported?: boolean` - Whether to append the popover to the body element. Default: `true` +- `showArrow?: boolean` - Whether to show the arrow pointing to the trigger. Default: `true` +- `offset?: number` - Offset of the popover from the trigger element (in pixels). + +**Events** + +- `update:visible` - Emitted when visibility changes. Payload: `boolean`. Used with `v-model:visible`. +- `before-enter` - Emitted before the popover enter animation starts. +- `after-leave` - Emitted after the popover leave animation completes. + +**Slots** + +- `reference` - The trigger element that activates the popover (required). +- `default` - The popover content. Receives `{ close: () => void }` scope for programmatic closing. + +### Template usage example + +**Basic click popover:** + +```vue + + + +``` + +**Controlled visibility with v-model:** + +```vue + + + +``` + +**With custom styling:** + +```vue + + + +``` + +**Without arrow and with offset:** + +```vue + + + +``` + +**Non-teleported (stays in DOM hierarchy):** + +```vue + + + +``` + +**Using close function from slot scope:** + +```vue + + + +``` + +**With animation lifecycle events:** + +```vue + + + +```