AttachMenu · AskAI

The attach gesture: right-click anything to make it context, or ask where the data is.

Install it:

npx shadcn add @ambientui/attach-menu

Live

Inline entry point (hover the row)

composer.tsx

Behavior

  • ·THE UNIVERSAL GESTURE of the ambient layer. Right-click any element and it becomes a ContextChip — this is how the assistant learns what you mean without you describing it.
  • ·Two verbs, deliberately: Explain (attach, ask, open the panel) for the impatient path, Add to chat context (attach, say nothing) for the deliberate one. A third would make it a menu.
  • ·AskAI is the inline entry point — it lives IN the row, revealed on hover, because a question asked where the thing is costs no navigation and no retyping. Requires `relative group/row` on the row.
  • ·It FLOATS rather than sitting in flow: an affordance that resizes the thing being hovered makes the whole list flinch under the pointer. Revealing it costs no layout.
  • ·Any click OUTSIDE, scroll, or Escape dismisses the menu: a context menu that survives the next interaction is a modal nobody asked for. Pointerdown inside it is the first half of choosing an item, so it must not dismiss — that is what made both verbs unreachable.
  • ·openAt(x, y, chip) opens it without a pointer, so a guided tour can perform the gesture ON the real row rather than describe it. The user still picks the verb; nothing is executed for them.
  • ·This is the whole product side of the contract. A surface hands over a chip; it never learns how an answer is rendered.

When to use

  • ·On any object a user might reasonably ask about — a row, a cell, a file, a line of code.
  • ·Beside a problem or anomaly the product already surfaces; that is the moment the question exists.

When not to

  • ·On every element indiscriminately — if everything is attachable, the gesture stops meaning anything.
  • ·As a replacement for the product's own actions; this attaches context, it does not perform work.