Site

Connect menu

The site's connect menu: a White button that opens a panel of the agents your MCP server can be added to, each row with its mark or first letter, a muted line and Open, plus a row that copies a setup prompt for any other agent; a pill slides to the row under the pointer or focus.

Install

React apps get the React files; every other stack gets the web component.

npx spyglass-ds add connect-menu
<script type="module" src="/spyglass-ds/elements/connect-menu.js"></script>

Usage

A hero or a page head's main action when the product connects to agents (MCP); up near the foot of a page; pass marks and each client's mark only when you may show them.

Never

  • Third-party logos without permission: by default rows show their first letter and the button shows no marks
  • A second White button beside it: pair it with a quiet one
  • Arrows that move on hover: they change color only
  • Shadows under the panel: it sits on a hairline

Adds with it: button

Props

The web component takes the same as attributes or properties (<spyglass-connect-menu>); title is heading there.

<ConnectMenu>

PropTypeDefault
contentConnectContent

The copy, the rows and the prompt (lib/connect.ts).

marksstring[]

Marks shown before the label (SVG files, drawn White in 16px squares).

[]
upboolean

Open the panel above the button (for a menu near the foot of a page).

false
onCopy(prompt: string) => void

Called after the prompt is copied.

classNamestring

Examples

The same example in React and as web components; both render identically.

react/examples/connect-menu/Default.tsx
import { ConnectMenu } from '@/react/components/site/ConnectMenu'
// The connect menu with Acme's neutral rows: each client shows its first letter.

export default function Default() {
  return (
    <div className="flex min-h-96 w-full items-start justify-center px-4 pt-8">
      <ConnectMenu />
    </div>
  )
}
elements/examples/connect-menu/Default.html
<!-- The connect menu with Acme's neutral rows: each client shows its first letter. -->
<div class="flex min-h-96 w-full items-start justify-center px-4 pt-8">
  <spyglass-connect-menu></spyglass-connect-menu>
</div>
react/examples/connect-menu/Up.tsx
import { ConnectMenu } from '@/react/components/site/ConnectMenu'
// Near the foot of a page the panel opens above the button.

export default function Up() {
  return (
    <div className="flex min-h-96 w-full items-end justify-center px-4 pb-8">
      <ConnectMenu up />
    </div>
  )
}
elements/examples/connect-menu/Up.html
<!-- Near the foot of a page the panel opens above the button. -->
<div class="flex min-h-96 w-full items-end justify-center px-4 pb-8">
  <spyglass-connect-menu up></spyglass-connect-menu>
</div>

Source

react/components/site/ConnectMenu.tsx
'use client'
import { useEffect, useId, useLayoutEffect, useRef, useState, type CSSProperties, type KeyboardEvent, type MouseEvent, type PointerEvent } from 'react'
import { CONNECT_ICONS, connectContent, type ConnectContent } from '@/lib/connect'
import { followGlow } from '@/lib/glow'
import { cn } from '@/react/lib/cn'

// The site's connect menu (v3/V3Playground ConnectMenu): a White 40px button (12px in, the clients' marks before the
// label when given, a chevron that turns over while open) that opens a #1A1A1A panel 8px under it (336px; the
// button's width on phones): a row per client (a 32px tile with its mark or first letter, the name over a muted line,
// "Open" and an arrow that turn White on the row under the pointer or focus), a hairline, and a row that copies a
// setup prompt (its icon and label cross over to a check and "Prompt copied" for 2s). A #262626 pill slides to the
// row under the pointer or focus. A click opens it with a quick fade and grow from the button's corner (160ms in,
// 120ms out); opened from the keyboard it appears at once and focus goes to the first row. Arrows move between rows,
// Escape closes it and gives focus back, a click or focus outside closes it. Reduced motion keeps the fade only.
export interface ConnectMenuProps {
  /** The copy, the rows and the prompt (lib/connect.ts). */
  content?: ConnectContent
  /** Marks shown before the label (SVG files, drawn White in 16px squares). */
  marks?: string[]
  /** Open the panel above the button (for a menu near the foot of a page). */
  up?: boolean
  /** Called after the prompt is copied. */
  onCopy?: (prompt: string) => void
  className?: string
}

const TRIGGER =
  'relative isolate inline-flex h-control-md shrink-0 cursor-pointer items-center justify-center gap-2 overflow-hidden rounded-control bg-action-primary px-3 type-ui-strong whitespace-nowrap text-action-primary-fg select-none transition-[background-color,color] duration-160 ease-out before:pointer-events-none before:absolute before:inset-0 before:-z-1 before:bg-[radial-gradient(circle_var(--ds-glow-radius)_at_var(--glow-x,50%)_var(--glow-y,50%),var(--ds-color-action-glow),transparent)] before:opacity-0 before:transition-opacity before:duration-240 before:ease-out hover:before:opacity-100 max-md:w-full'

function Glyph({ name, className }: { name: keyof typeof CONNECT_ICONS; className?: string }) {
  return <svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true" className={cn('flex-none fill-none stroke-current stroke-[1.5] [stroke-linecap:round] [stroke-linejoin:round]', className)} dangerouslySetInnerHTML={{ __html: CONNECT_ICONS[name] }} />
}

export function ConnectMenu({ content: c = connectContent, marks = [], up = false, onCopy, className }: ConnectMenuProps) {
  const [open, setOpen] = useState(false)
  const [instant, setInstant] = useState(false)
  const [copied, setCopied] = useState(false)
  const [active, setActive] = useState(0)
  const [pill, setPill] = useState<{ y: number; h: number } | null>(null)
  const rootRef = useRef<HTMLDivElement>(null)
  const panelRef = useRef<HTMLDivElement>(null)
  const buttonRef = useRef<HTMLButtonElement>(null)
  const panelId = `${useId()}-panel`
  const copyIndex = c.clients.length

  useEffect(() => {
    if (!open) return
    const onDown = (e: globalThis.PointerEvent) => { if (!rootRef.current?.contains(e.target as Node)) setOpen(false) }
    const onKey = (e: globalThis.KeyboardEvent) => {
      if (e.key !== 'Escape') return
      setOpen(false)
      buttonRef.current?.focus({ preventScroll: true })
    }
    document.addEventListener('pointerdown', onDown)
    document.addEventListener('keydown', onKey)
    return () => {
      document.removeEventListener('pointerdown', onDown)
      document.removeEventListener('keydown', onKey)
    }
  }, [open])

  useEffect(() => {
    if (!copied) return
    const t = window.setTimeout(() => setCopied(false), 2000)
    return () => window.clearTimeout(t)
  }, [copied])

  // The pill follows the active row; it moves by transform only, its height set at once.
  useLayoutEffect(() => {
    const row = panelRef.current?.querySelectorAll<HTMLElement>('[data-row]')[active]
    if (row && row.offsetHeight) setPill({ y: row.offsetTop, h: row.offsetHeight })
  }, [active, open])

  const rows = () => [...(panelRef.current?.querySelectorAll<HTMLElement>('[data-row]') ?? [])]

  const toggle = (e: MouseEvent<HTMLButtonElement>) => {
    const next = !open
    const keyboard = e.detail === 0
    setInstant(keyboard)
    setOpen(next)
    if (next) setActive(0)
    if (next && keyboard) requestAnimationFrame(() => rows()[0]?.focus({ preventScroll: true }))
  }

  const onPanelKey = (e: KeyboardEvent<HTMLDivElement>) => {
    if (!['ArrowDown', 'ArrowUp', 'Home', 'End'].includes(e.key)) return
    e.preventDefault()
    const list = rows()
    const at = list.indexOf(document.activeElement as HTMLElement)
    const next = e.key === 'Home' ? 0 : e.key === 'End' ? list.length - 1 : (at + (e.key === 'ArrowDown' ? 1 : -1) + list.length) % list.length
    list[next]?.focus()
  }

  const copy = async () => {
    try {
      await navigator.clipboard.writeText(c.prompt)
    } catch {}
    setCopied(true)
    onCopy?.(c.prompt)
  }

  return (
    <div
      ref={rootRef}
      data-ds="connect-menu"
      data-open={open || undefined}
      data-up={up || undefined}
      data-instant={instant || undefined}
      className={cn('ds-connect relative max-md:w-full', className)}
      onBlur={(e) => { if (open && e.relatedTarget && !rootRef.current?.contains(e.relatedTarget as Node)) setOpen(false) }}
    >
      <style href="ds-connect-menu" precedence="ds">{css}</style>
      <button ref={buttonRef} type="button" className={TRIGGER} aria-expanded={open} aria-controls={panelId} onClick={toggle} onPointerMove={(e: PointerEvent<HTMLButtonElement>) => followGlow(e.currentTarget, e)}>
        {marks.length ? (
          <span aria-hidden="true" className="mr-1 flex items-center gap-1">
            {marks.map((src) => <span key={src} className="size-4 bg-current" style={{ mask: `url("${src}") center / contain no-repeat` } as CSSProperties} />)}
          </span>
        ) : null}
        {c.label}
        <Glyph name="chevron" className="ds-connect-chevron stroke-[1.75]" />
      </button>
      <div ref={panelRef} id={panelId} inert={!open} onKeyDown={onPanelKey} className={cn('ds-connect-panel absolute left-0 z-10 isolate grid w-84 rounded-control border border-edge bg-surface-subtle p-1 text-left max-md:w-full', up ? 'bottom-[calc(100%+var(--ds-space-sm))]' : 'top-[calc(100%+var(--ds-space-sm))]')}>
        {pill ? <span aria-hidden="true" className="ds-connect-pill pointer-events-none absolute top-0 left-1 -z-1 w-[calc(100%-2*var(--ds-space-xs))] rounded-ds-sm bg-surface-raised" style={{ height: pill.h, transform: `translateY(${pill.y}px)` }} /> : null}
        <ul className="grid" aria-label={c.menuLabel}>
          {c.clients.map((client, i) => (
            <li key={client.id}>
              <a
                data-row=""
                data-active={i === active || undefined}
                href={client.href}
                target={client.web ? '_blank' : undefined}
                rel={client.web ? 'noopener noreferrer' : undefined}
                className="group/row flex items-center gap-3 rounded-ds-sm p-2 outline-none focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-edge-focus"
                onPointerEnter={() => setActive(i)}
                onFocus={() => setActive(i)}
                onClick={() => setOpen(false)}
              >
                <span aria-hidden="true" className="grid size-8 flex-none place-items-center rounded-ds-sm bg-surface-raised transition-[background-color] duration-160 ease-loop group-data-active/row:bg-surface-inset">
                  {client.mark ? <span className="size-4 bg-fg" style={{ mask: `url("${client.mark}") center / contain no-repeat` } as CSSProperties} /> : <span className="type-caption font-medium text-fg">{client.name.slice(0, 1)}</span>}
                </span>
                <span className="grid min-w-0 flex-1">
                  <span className="type-ui font-medium text-fg">{client.name}</span>
                  <span className="type-caption text-pretty text-fg-muted">{client.description}</span>
                </span>
                <span className="flex flex-none items-center gap-1 type-caption text-fg-muted transition-[color] duration-160 ease-loop group-data-active/row:text-fg">
                  <span className="max-md:hidden">{c.open}</span>
                  <Glyph name="arrow" />
                </span>
              </a>
            </li>
          ))}
        </ul>
        <span aria-hidden="true" className="-mx-1 my-1 h-px bg-edge" />
        <button
          type="button"
          data-row=""
          data-active={active === copyIndex || undefined}
          data-copied={copied || undefined}
          className="ds-connect-copy flex h-control-md cursor-pointer items-center gap-3 rounded-ds-sm px-2 text-left type-ui font-medium text-fg-soft outline-none transition-[color] duration-160 ease-loop focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-edge-focus data-active:text-fg data-copied:text-fg max-md:h-control-form"
          onPointerEnter={() => setActive(copyIndex)}
          onFocus={() => setActive(copyIndex)}
          onClick={copy}
        >
          <span aria-hidden="true" className="grid w-8 flex-none place-items-center">
            <Glyph name="copy" className="ds-connect-swap [grid-area:1/1]" />
            <Glyph name="check" className="ds-connect-swap [grid-area:1/1]" />
          </span>
          <span className="grid">
            <span className="ds-connect-label [grid-area:1/1]" data-on={!copied || undefined}>{c.copy.label}</span>
            <span className="ds-connect-label [grid-area:1/1]" data-on={copied || undefined} aria-hidden={!copied}>{c.copy.done}</span>
          </span>
        </button>
        <p className="sr-only" role="status">{copied ? c.copy.done : ''}</p>
      </div>
    </div>
  )
}

export default ConnectMenu

const css = `
.ds-connect-panel {
  opacity: 0; visibility: hidden; transform-origin: top left;
  transform: translateY(calc(-1 * var(--ds-space-xs))) scale(var(--ds-menu-from-scale));
  transition: opacity var(--ds-duration-press) var(--ds-easing-out), transform var(--ds-duration-press) var(--ds-easing-out), visibility var(--ds-duration-instant) linear var(--ds-duration-press);
}
.ds-connect[data-up] .ds-connect-panel { transform-origin: bottom left; transform: translateY(var(--ds-space-xs)) scale(var(--ds-menu-from-scale)); }
.ds-connect[data-open] .ds-connect-panel {
  opacity: 1; visibility: visible; transform: none;
  transition: opacity var(--ds-duration-micro) var(--ds-easing-out), transform var(--ds-duration-micro) var(--ds-easing-out), visibility var(--ds-duration-instant);
}
.ds-connect[data-instant] .ds-connect-panel { transition: none; }
.ds-connect-chevron { transition: transform var(--ds-duration-micro) var(--ds-easing-out); }
.ds-connect[data-open] .ds-connect-chevron { transform: rotate(180deg); }
.ds-connect-pill { transition: transform var(--ds-duration-micro) var(--ds-easing-loop); }
.ds-connect-swap, .ds-connect-label { transition: opacity var(--ds-duration-micro) var(--ds-easing-out), transform var(--ds-duration-micro) var(--ds-easing-out); }
.ds-connect-label:not([data-on]) { opacity: 0; transform: translateY(var(--ds-space-xs)); }
.ds-connect-label:not([data-on]):first-child { transform: translateY(calc(-1 * var(--ds-space-xs))); }
.ds-connect-swap:last-child, .ds-connect-copy[data-copied] .ds-connect-swap:first-child { opacity: 0; transform: scale(0.8); }
.ds-connect-copy[data-copied] .ds-connect-swap:last-child { opacity: 1; transform: none; }
@media (max-width: 767px) {
  .ds-connect-panel { transform-origin: top center; }
  .ds-connect[data-up] .ds-connect-panel { transform-origin: bottom center; }
}
@media (prefers-reduced-motion: reduce) {
  .ds-connect-panel, .ds-connect[data-up] .ds-connect-panel, .ds-connect[data-open] .ds-connect-panel { transform: none; }
  .ds-connect-chevron, .ds-connect-pill, .ds-connect-swap, .ds-connect-label { transition: opacity var(--ds-duration-micro) var(--ds-easing-out); }
  .ds-connect-label:not([data-on]), .ds-connect-label:not([data-on]):first-child, .ds-connect-swap:last-child, .ds-connect-copy[data-copied] .ds-connect-swap:first-child { transform: none; }
}
`
lib/connect.ts
// The connect menu's copy and rows (site v3/V3Playground ConnectMenu, content/v3/connect.ts): the agents an MCP server
// can be added to. Both flavors read it. The defaults are neutral Acme rows; pass your own clients and their marks.
export interface ConnectClient {
	id: string
	name: string
	/** One line under the name. */
	description: string
	href: string
	/** Opens in a new tab. */
	web?: boolean
	/** The client's mark (an SVG file, drawn as a White mask in a 16px square). Leave out for its first letter. */
	mark?: string
}

export interface ConnectContent {
	/** The trigger's label. */
	label: string
	/** The list's accessible name. */
	menuLabel: string
	/** The quiet word at the end of each row. */
	open: string
	copy: { label: string; done: string }
	/** What the copy row puts on the clipboard. */
	prompt: string
	clients: ConnectClient[]
}

export const connectContent: ConnectContent = {
	label: 'Connect to MCP',
	menuLabel: 'Connect Acme to your agent',
	open: 'Open',
	copy: { label: 'Copy prompt for another agent', done: 'Prompt copied' },
	prompt: 'Add the Acme MCP server to this agent. URL: https://mcp.acme.com/mcp (remote, Streamable HTTP). Sign in with Acme in the browser when asked.',
	clients: [
		{ id: 'chat', name: 'Acme Chat', description: 'Add as a custom connector', href: '#', web: true },
		{ id: 'assistant', name: 'Acme Assistant', description: 'Install the Acme plugin', href: '#', web: true },
		{ id: 'editor', name: 'Acme Editor', description: 'Adds Acme in one click', href: '#' },
	],
}

// The site's 16px glyphs (stroked, round caps), the same in both flavors.
export const CONNECT_ICONS = {
	chevron: '<path d="M4 6l4 4 4-4" />',
	arrow: '<path d="M5.5 10.5l5-5M6.5 5.5h4v4" />',
	copy: '<rect x="5.5" y="5.5" width="8" height="8" rx="1.5" /><path d="M10.5 3.5v-.5A1.5 1.5 0 0 0 9 1.5H4A1.5 1.5 0 0 0 2.5 3v5A1.5 1.5 0 0 0 4 9.5h.5" />',
	check: '<path d="M3.5 8.5l3 3 6-7" />',
}
react/lib/cn.ts
// Joins class names, skipping falsy ones: cn('a', on && 'b', ['c', undefined]). It does not merge conflicting
// utilities (no tailwind-merge), as Vue's class binding does not: the library's classes are written not to compete,
// and a className from the caller is appended after them, as Vue appends a fallthrough class.
export type ClassValue = string | false | null | undefined | 0 | ClassValue[]

export function cn(...values: ClassValue[]): string {
	const out: string[] = []
	for (const v of values) {
		if (!v) continue
		if (Array.isArray(v)) {
			const s = cn(...v)
			if (s) out.push(s)
		}
		else out.push(v)
	}
	return out.join(' ')
}
elements/components/site/connect-menu.ts
import { html, nothing, svg } from 'lit'
import { ifDefined } from 'lit/directives/if-defined.js'
import { unsafeSVG } from 'lit/directives/unsafe-svg.js'
import { DsElement, define, HostLayoutController, uid } from '@/elements/lib/element'
import { CONNECT_ICONS, connectContent, type ConnectContent } from '@/lib/connect'
import { followGlow } from '@/lib/glow'
import styles from 'virtual:tw'

// ConnectMenu.tsx as <spyglass-connect-menu>: the White button that opens the connect panel (a row per client, a
// hairline, a row that copies a setup prompt), the #262626 pill sliding to the row under the pointer or focus. A click
// opens it with a quick fade and grow; from the keyboard it appears at once with focus on the first row. Arrows move,
// Escape closes and gives focus back, a click or focus outside closes it. `content` (JSON), `marks` (JSON list of SVG
// files), `up`; fires `copy` with detail.prompt.

const TRIGGER =
	'relative isolate inline-flex h-control-md shrink-0 cursor-pointer items-center justify-center gap-2 overflow-hidden rounded-control bg-action-primary px-3 type-ui-strong whitespace-nowrap text-action-primary-fg select-none transition-[background-color,color] duration-160 ease-out before:pointer-events-none before:absolute before:inset-0 before:-z-1 before:bg-[radial-gradient(circle_var(--ds-glow-radius)_at_var(--glow-x,50%)_var(--glow-y,50%),var(--ds-color-action-glow),transparent)] before:opacity-0 before:transition-opacity before:duration-240 before:ease-out hover:before:opacity-100 max-md:w-full'

const glyph = (name: keyof typeof CONNECT_ICONS, cls = '') => html`<svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true" class=${`flex-none fill-none stroke-current stroke-[1.5] [stroke-linecap:round] [stroke-linejoin:round] ${cls}`.trim()}>${svg`${unsafeSVG(CONNECT_ICONS[name])}`}</svg>`

/**
 * @summary The connect menu: a White button that opens the agents to connect to and a copy-prompt row.
 * @fires copy - After the prompt is copied; detail.prompt is the text.
 */
export class ConnectMenu extends DsElement {
	static styles = [DsElement.styles, styles]
	protected readonly layout = new HostLayoutController(this, () => this.renderRoot.querySelector<HTMLElement>('[data-ds="connect-menu"]'))
	static properties = { content: { type: Object }, marks: { type: Array }, up: { type: Boolean }, open: { state: true }, instant: { state: true }, copied: { state: true }, active: { state: true }, pill: { state: true } }
	/** The copy, the rows and the prompt (lib/connect.ts). */
	content: ConnectContent = connectContent
	/** Marks before the label (SVG files, drawn White in 16px squares). */
	marks: string[] = []
	/** Open the panel above the button. */
	up = false
	private open = false
	private instant = false
	private copied = false
	private active = 0
	private pill: { y: number; h: number } | null = null
	private panelId = uid('connect')
	private timer = 0

	private onDown = (e: PointerEvent) => { if (!e.composedPath().includes(this)) this.open = false }
	private onKey = (e: KeyboardEvent) => {
		if (e.key !== 'Escape' || !this.open) return
		this.open = false
		this.button?.focus({ preventScroll: true })
	}
	private get button() { return this.renderRoot.querySelector<HTMLButtonElement>('[data-trigger]') }
	private rows() { return [...this.renderRoot.querySelectorAll<HTMLElement>('[data-row]')] }

	connectedCallback() {
		super.connectedCallback()
		document.addEventListener('pointerdown', this.onDown)
		document.addEventListener('keydown', this.onKey)
	}
	disconnectedCallback() {
		super.disconnectedCallback()
		document.removeEventListener('pointerdown', this.onDown)
		document.removeEventListener('keydown', this.onKey)
		clearTimeout(this.timer)
	}

	protected updated(changed: Map<string, unknown>) {
		super.updated(changed as never)
		if (changed.has('active') || changed.has('open')) {
			const row = this.rows()[this.active]
			if (row && row.offsetHeight && (this.pill?.y !== row.offsetTop || this.pill?.h !== row.offsetHeight)) this.pill = { y: row.offsetTop, h: row.offsetHeight }
		}
	}

	private toggle(e: MouseEvent) {
		const next = !this.open
		const keyboard = e.detail === 0
		this.instant = keyboard
		this.open = next
		if (next) this.active = 0
		if (next && keyboard) requestAnimationFrame(() => this.rows()[0]?.focus({ preventScroll: true }))
	}

	private onPanelKey(e: KeyboardEvent) {
		if (!['ArrowDown', 'ArrowUp', 'Home', 'End'].includes(e.key)) return
		e.preventDefault()
		const list = this.rows()
		const at = list.indexOf((this.renderRoot as ShadowRoot).activeElement as HTMLElement)
		const next = e.key === 'Home' ? 0 : e.key === 'End' ? list.length - 1 : (at + (e.key === 'ArrowDown' ? 1 : -1) + list.length) % list.length
		list[next]?.focus()
	}

	private async copy() {
		const c = this.content ?? connectContent
		try {
			await navigator.clipboard.writeText(c.prompt)
		} catch {}
		this.copied = true
		clearTimeout(this.timer)
		this.timer = window.setTimeout(() => (this.copied = false), 2000)
		this.emit('copy', { prompt: c.prompt })
	}

	render() {
		const c = this.content ?? connectContent
		const marks = this.marks ?? []
		const copyIndex = c.clients.length
		return html`<div data-ds="connect-menu" data-open=${ifDefined(this.open ? '' : undefined)} data-up=${ifDefined(this.up ? '' : undefined)} data-instant=${ifDefined(this.instant ? '' : undefined)} class="ds-connect relative max-md:w-full" @focusout=${(e: FocusEvent) => { const root = e.currentTarget as HTMLElement; if (this.open && e.relatedTarget && !root.contains(e.relatedTarget as Node)) this.open = false }}><button data-trigger type="button" class=${TRIGGER} aria-expanded=${String(this.open)} aria-controls=${this.panelId} @click=${this.toggle} @pointermove=${(e: PointerEvent) => followGlow(e.currentTarget as HTMLElement, e)}>${marks.length ? html`<span aria-hidden="true" class="mr-1 flex items-center gap-1">${marks.map((src) => html`<span class="size-4 bg-current" style=${`mask: url("${src}") center / contain no-repeat`}></span>`)}</span>` : nothing}${c.label}${glyph('chevron', 'ds-connect-chevron stroke-[1.75]')}</button><div id=${this.panelId} ?inert=${!this.open} @keydown=${this.onPanelKey} class=${`ds-connect-panel absolute left-0 z-10 isolate grid w-84 rounded-control border border-edge bg-surface-subtle p-1 text-left max-md:w-full ${this.up ? 'bottom-[calc(100%+var(--ds-space-sm))]' : 'top-[calc(100%+var(--ds-space-sm))]'}`}>${this.pill ? html`<span aria-hidden="true" class="ds-connect-pill pointer-events-none absolute top-0 left-1 -z-1 w-[calc(100%-2*var(--ds-space-xs))] rounded-ds-sm bg-surface-raised" style=${`height: ${this.pill.h}px; transform: translateY(${this.pill.y}px)`}></span>` : nothing}<ul class="grid" aria-label=${c.menuLabel}>${c.clients.map((client, i) => html`<li><a data-row data-active=${ifDefined(i === this.active ? '' : undefined)} href=${client.href} target=${ifDefined(client.web ? '_blank' : undefined)} rel=${ifDefined(client.web ? 'noopener noreferrer' : undefined)} class="group/row flex items-center gap-3 rounded-ds-sm p-2 outline-none focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-edge-focus" @pointerenter=${() => (this.active = i)} @focus=${() => (this.active = i)} @click=${() => (this.open = false)}><span aria-hidden="true" class="grid size-8 flex-none place-items-center rounded-ds-sm bg-surface-raised transition-[background-color] duration-160 ease-loop group-data-active/row:bg-surface-inset">${client.mark ? html`<span class="size-4 bg-fg" style=${`mask: url("${client.mark}") center / contain no-repeat`}></span>` : html`<span class="type-caption font-medium text-fg">${client.name.slice(0, 1)}</span>`}</span><span class="grid min-w-0 flex-1"><span class="type-ui font-medium text-fg">${client.name}</span><span class="type-caption text-pretty text-fg-muted">${client.description}</span></span><span class="flex flex-none items-center gap-1 type-caption text-fg-muted transition-[color] duration-160 ease-loop group-data-active/row:text-fg"><span class="max-md:hidden">${c.open}</span>${glyph('arrow')}</span></a></li>`)}</ul><span aria-hidden="true" class="-mx-1 my-1 h-px bg-edge"></span><button type="button" data-row data-active=${ifDefined(this.active === copyIndex ? '' : undefined)} data-copied=${ifDefined(this.copied ? '' : undefined)} class="ds-connect-copy flex h-control-md cursor-pointer items-center gap-3 rounded-ds-sm px-2 text-left type-ui font-medium text-fg-soft outline-none transition-[color] duration-160 ease-loop focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-edge-focus data-active:text-fg data-copied:text-fg max-md:h-control-form" @pointerenter=${() => (this.active = copyIndex)} @focus=${() => (this.active = copyIndex)} @click=${this.copy}><span aria-hidden="true" class="grid w-8 flex-none place-items-center">${glyph('copy', 'ds-connect-swap [grid-area:1/1]')}${glyph('check', 'ds-connect-swap [grid-area:1/1]')}</span><span class="grid"><span class="ds-connect-label [grid-area:1/1]" data-on=${ifDefined(this.copied ? undefined : '')}>${c.copy.label}</span><span class="ds-connect-label [grid-area:1/1]" data-on=${ifDefined(this.copied ? '' : undefined)} aria-hidden=${String(!this.copied)}>${c.copy.done}</span></span></button><p class="sr-only" role="status">${this.copied ? c.copy.done : ''}</p></div></div>`
	}
}

define('connect-menu', ConnectMenu)
elements/components/site/connect-menu.css
.ds-connect-panel {
  opacity: 0; visibility: hidden; transform-origin: top left;
  transform: translateY(calc(-1 * var(--ds-space-xs))) scale(var(--ds-menu-from-scale));
  transition: opacity var(--ds-duration-press) var(--ds-easing-out), transform var(--ds-duration-press) var(--ds-easing-out), visibility var(--ds-duration-instant) linear var(--ds-duration-press);
}
.ds-connect[data-up] .ds-connect-panel { transform-origin: bottom left; transform: translateY(var(--ds-space-xs)) scale(var(--ds-menu-from-scale)); }
.ds-connect[data-open] .ds-connect-panel {
  opacity: 1; visibility: visible; transform: none;
  transition: opacity var(--ds-duration-micro) var(--ds-easing-out), transform var(--ds-duration-micro) var(--ds-easing-out), visibility var(--ds-duration-instant);
}
.ds-connect[data-instant] .ds-connect-panel { transition: none; }
.ds-connect-chevron { transition: transform var(--ds-duration-micro) var(--ds-easing-out); }
.ds-connect[data-open] .ds-connect-chevron { transform: rotate(180deg); }
.ds-connect-pill { transition: transform var(--ds-duration-micro) var(--ds-easing-loop); }
.ds-connect-swap, .ds-connect-label { transition: opacity var(--ds-duration-micro) var(--ds-easing-out), transform var(--ds-duration-micro) var(--ds-easing-out); }
.ds-connect-label:not([data-on]) { opacity: 0; transform: translateY(var(--ds-space-xs)); }
.ds-connect-label:not([data-on]):first-child { transform: translateY(calc(-1 * var(--ds-space-xs))); }
.ds-connect-swap:last-child, .ds-connect-copy[data-copied] .ds-connect-swap:first-child { opacity: 0; transform: scale(0.8); }
.ds-connect-copy[data-copied] .ds-connect-swap:last-child { opacity: 1; transform: none; }
@media (max-width: 767px) {
  .ds-connect-panel { transform-origin: top center; }
  .ds-connect[data-up] .ds-connect-panel { transform-origin: bottom center; }
}
@media (prefers-reduced-motion: reduce) {
  .ds-connect-panel, .ds-connect[data-up] .ds-connect-panel, .ds-connect[data-open] .ds-connect-panel { transform: none; }
  .ds-connect-chevron, .ds-connect-pill, .ds-connect-swap, .ds-connect-label { transition: opacity var(--ds-duration-micro) var(--ds-easing-out); }
  .ds-connect-label:not([data-on]), .ds-connect-label:not([data-on]):first-child, .ds-connect-swap:last-child, .ds-connect-copy[data-copied] .ds-connect-swap:first-child { transform: none; }
}

Reference: Site v3/V3Playground ConnectMenu (ConnectMenu.module.css, content/v3/connect.ts): the .btn--primary trigger at 12px in with a 16px chevron that turns over; the panel 8px under it, 336px (100% under 768), 4px in, #1A1A1A in a --line hairline with an 8px corner; rows 8px in with a 32px tile, 14/20 Medium name over a 12/16 --text-3 line; a hairline; the copy row 40px (48 on phones); the --surface sliding pill; 160ms in and 120ms out from scale 0.96. The library drops the panel shadow, keeps the arrow still, and opens at once from the keyboard.