shadcn.io is an independent project built on shadcn/ui
Components
Free
Open in Chat for Vue UI SDK
A menu that opens your question in ChatGPT, Claude, Cursor, v0, T3 Chat or Scira, each in a new tab. Built for Vue on UI SDK.
On this page11 sections
Open in Chat is a button that drops down a list of AI apps, each a link that starts a new chat in a new tab with your question already typed in. Put it under a docs page, beside a search result or at the end of an answer, where a reader may want to carry on with their own assistant.
It is a Dropdown Menu of links, so nothing is sent until someone picks an app, and the conversation happens there, not on your page.
Installation
Sign in to get your install command
Free with an account. It carries your token, so the CLI installs everything in one go.
<template>
<OpenInquery="How can I implement authentication in Next.js?">
<OpenInTrigger />
<OpenInContent>
<OpenInChatGPT />
<OpenInClaude />
<OpenInCursor />
</OpenInContent>
</OpenIn>
</template>
query is the text every app opens with. With no children, OpenInTrigger draws an outline Open in chat button with a chevron.
Accessibility
The trigger is a button with aria-haspopup="menu" and aria-expanded, and the list is a role="menu" labelled by the trigger, where each item is a link that carries the menu item role. The app marks and the arrow are hidden from screen readers, so each item is named by its text and a visually hidden note, such as Open in Claude (opens in a new tab). Typing a letter moves to the next app whose name starts with it, so pressing C again and again cycles through ChatGPT, Claude and Cursor. Escape closes the menu and returns focus to the trigger. A trigger of your own that shows only an icon needs an aria-label.
KeyAction
Enter
When focus is on the trigger, opens the menu on its first item. On an item, opens that app in a new tab and closes the menu.
Space
When focus is on the trigger, opens the menu on its first item. On an item, opens that app in a new tab and closes the menu.
Arrow Down
When focus is on the trigger, opens the menu on its first item. In the menu, moves focus to the next item, and from the last one back to the first.
Arrow Up
When focus is on the trigger, opens the menu on its last item. In the menu, moves focus to the previous item, and from the first one to the last.
Home
Moves focus to the first item.
End
Moves focus to the last item.
EscEscape
Closes the menu and moves focus to the trigger.
Providers
Each item is a link to its app with the query in the URL, opened in a new tab with rel="noopener noreferrer", so the app can't reach back into your page or see where the reader came from.
Part
Opens
Query in
OpenInChatGPT
https://chatgpt.com/ with search on
prompt
OpenInClaude
https://claude.ai/new
q
OpenInT3
https://t3.chat/new
q
OpenInScira
https://scira.ai/
q
OpenInv0
https://v0.app
q
OpenInCursor
https://cursor.com/link/prompt
text
label replaces an item's text, Open in and the app's name, and becomes what typing in the open menu matches, which is otherwise the app's name alone. Each app reads its own parameter, and an app can change it, so when one stops filling in the question, compare its current address with this table before you look at the component.
Demos
Labels
The six apps in two groups, Chat and Code, each an OpenInGroup with an OpenInLabel on top and an OpenInSeparator between them. label shortens every item to the app's name, Claude rather than Open in Claude, since the heading already says what the menu does. Use groups when the list mixes chat apps with tools that write code.
Custom
Two items of your own under ChatGPT and Claude: an OpenInItem that links to Perplexity, its URL built from the same query, and a Copy prompt item that copies the query and reads Copied for a moment. The copy item keeps the menu open through closeOnSelect set to false. Use OpenInItem for an app the component doesn't know.
Trigger
An Ask AI button with a sparkle icon under an answer about useEffect running twice, with that question as the query. The button reaches OpenInTrigger through render. Use a small ghost button where the menu is a side path, and the default outline button where opening a chat is the point.
Migrating from AI SDK Elements
AI SDK Elements is for React. In Vue, Open in Chat has the same parts and props, and the demos above show them in Vue's syntax.
FAQ
Which AI apps can Open in Chat open?
ChatGPT, Claude, T3 Chat, Scira, v0 and Cursor, one part each, and every one a link with the query in its URL. The Providers table lists each address and the parameter it reads, and ChatGPT opens with search turned on.
Put in only the apps your readers use, since six rows is already a long menu for a side path. For an app that isn't on the list, add an OpenInItem of your own.
How does Open in Chat pass the question to each app?
Through the URL. Set query on OpenIn, and each item reads it and builds its link with URLSearchParams, so spaces, question marks and quotes arrive intact in the app's text field.
Keep it to a question or a short prompt, because the whole query travels in the address. To ask about a long page, put the page's URL in the query rather than its text.
How do I make Open in Chat ask about the current page?
Put the page in the query. A prompt such as Read this page and answer my questions about it, followed by the page's URL, lets an app that can browse fetch it and start from your content rather than what it already knows.
Point it at the plainest version of the page you have. A Markdown copy, if your site serves one, is quicker for the model to read than the rendered HTML, and the query stays short either way.
How do I add another app to Open in Chat?
Add an OpenInItem that renders a link through render, with the app's name as its label, which typing in the open menu matches, as the Custom demo does for Perplexity.
Build its address from the same query with URLSearchParams, open it in a new tab with rel="noopener noreferrer", and give it an icon, a name and the arrow so it matches the built-in items, with "(opens in a new tab)" in a visually hidden span after the name. Inside OpenIn, a component of your own reads the query from useOpenInContext.
Why does Open in Chat open a new tab?
So the reader keeps your page while the chat starts beside it. Each item is a link with target="_blank" and rel="noopener noreferrer", so the app gets the query in its URL and nothing else, neither a handle on your window nor the address the reader came from.
The arrow after each name shows the new tab to sighted users and is hidden from screen readers, so each item also ends in a visually hidden note, and a screen reader reads Open in Claude (opens in a new tab). An OpenInItem of your own needs the same note in its text.
Can Open in Chat be used with the keyboard?
Yes. Enter, Space or ArrowDown on the trigger opens the menu and ArrowUp opens it on the last app, the arrow keys move between apps and wrap around at the ends, and Home and End jump to the first and last. Enter or Space opens the focused app in a new tab and closes the menu.
Escape closes the menu without opening anything and puts focus back on the trigger. The Accessibility section lists every key.
How do I keep the Open in Chat menu open after an item is chosen?
Set closeOnSelect to false on that OpenInItem and run your code in its @select handler, which UI SDK calls for a click and for Enter or Space alike.
The Custom demo's Copy prompt item works this way: it copies the query and reads Copied for a second and a half, with the menu still open so people can see it worked. Leave the app links closing it, since the new tab takes the reader away anyway.
Is this the same as AI SDK Elements' Open in Chat?
It has the same parts and props as that React component, and here the links also hide your page's address from the apps, Scira takes a label like the rest, and OpenInGroup holds a labelled group. AI SDK Elements is for React only, so there is nothing to migrate in Vue, and the demos above show every part in its syntax.
API Reference
OpenIn
PropType
open?boolean
Whether the menu is open. Pass it to control the menu. Two-way with v-model or v-model:open.
defaultOpen?boolean
Whether the menu starts open, when uncontrolled.
Default
false
querystring
The text to open each chat with: a question, a prompt or a page.
container?DocumentFragment | Element | null
Renders the popup into this element instead of in place, like a container inside a shadow root or an iframe. On web components, a CSS selector. Nested popups stay inside their parent.
Type
DocumentFragment | Element | null
controller?MenuController
Opens, closes and inspects the menu from anywhere, and connects triggers outside it. Create one with createMenuController().
debug?boolean
Logs every state change with its reason to the console, in development builds.
delay?number
Milliseconds the pointer rests on a submenu trigger before its submenu opens.
Default
100
dismissible?boolean
Whether Escape, an outside press, focus or the window leaving, Android's back gesture and a sheet's swipe can close it. Triggers, Close parts and the controller always can. Pass false while it holds unsaved work, and ask in onDismissAttempt.
Default
true
items?MenuData
The menu as data. Renders the content for you, unless you place a content part of your own, and runs the items' shortcuts.
itemShortcuts?boolean
Whether a data menu runs its items' shortcuts while closed.
Default
true
loop?boolean
Whether arrow keys wrap from the last item to the first.
Default
true
modal?"pointer" | boolean
"pointer": an outside press only closes the menu. true: also locks scroll, traps focus and makes the rest of the page inert. false: outside presses reach what they hit.
Type
"pointer" | boolean
Default
"pointer", or true while it presents as a sheet
pendingAnnouncement?string
What screen readers hear once an item has been pending for a second, so a slow action doesn't pass in silence. Set it in the page's language. An empty string says nothing.
Default
"Loading"
presentation?PresentationSetting<"popover">
How the menu presents. "sheet" slides it up from the bottom of the screen, where it can be swiped away and submenus open in its place, and "auto" does that on small touch screens. Decided each time it opens; the server renders "popover" for "auto". A context menu and a menu in a menubar are always popovers.
Runs for every plain item, including items in submenus, with the item's value. Return a Promise to mark the item pending until it settles: it gets data-pending, aria-busy and aria-disabled, the menu stays open, and choosing it again waits. It closes once the Promise resolves, and a rejection keeps it open with the reason in the item's error state until the next try.
Runs when dismissible refused a dismissal made on purpose: Escape, an outside press, back or a swipe. Focus or the window leaving is refused without it. Ask "Discard changes?" here.
Runs when the payload the content shows changes: a trigger or context area with another payload opens the menu, or takes the open menu over, which fires no onOpenChange, and so does a controller's open({ payload }) on the open menu. details.cancel() keeps the previous payload.
Stops the trigger from opening the menu. A native button can't be focused or pressed, unless focusableWhenDisabled is set.
Default
false
focusableWhenDisabled?boolean
Keeps a disabled trigger in the tab order with aria-disabled instead of the native attribute, so it can host a tooltip that says why. Presses still do nothing.
Default
false
payload?unknown
Data for the content to render when this trigger opens the menu, like the row it belongs to.
shortcut?string
A keyboard shortcut that opens the menu from anywhere, like "mod+j". mod is Command on Apple platforms and Control elsewhere. Sets aria-keyshortcuts.
#render?{ props, state, children }
A slot that renders your own element: bind its props with v-bind="props". It also gets the part's state, and children, its content.
Default
<Button type="button" variant="outline" />
OpenInContent
data-slot="open-in-content"
PropType
align?Align
How the popup lines up with the anchor along that side. start and end follow the reading direction. How the menu lines up with the trigger along that side.
Default
"start"
alignOffset?number
Shift along the anchor, in pixels. Shift along the trigger, in pixels. Submenus default to lining up their first item with the trigger.
anchor?string | Anchor | null
Positions the popup against this instead of its trigger: an element, a CSS selector, a point like { x, y }, or anything with getBoundingClientRect(). It's read on every check, so it can move. A controller's open({ anchor }) wins for that open.
Type
string | Anchor | null
arrowPadding?number
Space to keep between the arrow and the popup's corners, in pixels.
Default
6
collisionPadding?number
Space to keep from the viewport edges, in pixels.
Default
8
container?DocumentFragment | Element | null
Renders the popup into this element instead of in place, like a container inside a shadow root or an iframe. On web components, a CSS selector. Nested popups stay inside their parent.
Type
DocumentFragment | Element | null
finalFocus?PopupFocusTarget
Where focus goes when the menu closes while focus is inside it. "trigger" returns it to the trigger and "none" leaves it. A CSS selector, an element or a function picks a specific element.
Default
"trigger"
keepMounted?boolean
Whether the menu stays in the page, hidden, while closed. Its content keeps its state between opens.
Default
false
side?DropdownMenuSide
The side of the trigger it opens on. It flips when there's no room, unless avoidCollisions is off.
sideOffset?number
Gap between the anchor and the popup, in pixels. Gap between the trigger and the menu, in pixels.
Default
4
#render?{ props, state, children }
A slot that renders your own element: bind its props with v-bind="props". It also gets the part's state, and children, its content.
class?string
Merged with the part's classes.
OpenInItem
data-slot="open-in-item"
PropType
closeOnSelect?boolean
Whether running the item closes the menu.
Default
true
destructive?boolean
Styles the item as dangerous, like Delete. Sets data-destructive.
disabled?boolean
Keeps the item focusable but stops it from running, as the menu pattern asks. Sets data-disabled and aria-disabled.
inset?boolean
Indents it to line up with items that have an icon or indicator.
label?string
The text typeahead matches, when the content isn't plain text. It isn't the accessible name: use aria-label for that.
shortcut?string
A keyboard shortcut like "mod+n". Shows ⌘N on Apple platforms and Ctrl+N elsewhere, and sets aria-keyshortcuts.
value?string
Passed to onAction when the item runs.
variant?"default" | "destructive"
The visual style.
Type
"default" | "destructive"
#render?{ props, state, children }
A slot that renders your own element: bind its props with v-bind="props". It also gets the part's state, and children, its content.
class?string
Merged with the part's classes.
EventType
@select(event: Event) → unknown
Runs when the item is selected, by pointer or keyboard, with the event that selected it, or a new select Event when no DOM event did. Call event.preventDefault() to keep the menu open and skip onAction. Return a Promise to mark the item pending until it settles, like onAction.
Parameters
event – Event
Returns
unknown
OpenInGroup
data-slot="open-in-group"
PropType
#render?{ props, state, children }
A slot that renders your own element: bind its props with v-bind="props". It also gets the part's state, and children, its content.
OpenInLabel
data-slot="open-in-label"
PropType
inset?boolean
Indents it to line up with items that have an icon or indicator.
#render?{ props, state, children }
A slot that renders your own element: bind its props with v-bind="props". It also gets the part's state, and children, its content.
class?string
Merged with the part's classes.
OpenInSeparator
data-slot="open-in-separator"
PropType
#render?{ props, state, children }
A slot that renders your own element: bind its props with v-bind="props". It also gets the part's state, and children, its content.
class?string
Merged with the part's classes.
OpenInChatGPT
PropType
closeOnSelect?boolean
Whether running the item closes the menu.
Default
true
destructive?boolean
Styles the item as dangerous, like Delete. Sets data-destructive.
disabled?boolean
Keeps the item focusable but stops it from running, as the menu pattern asks. Sets data-disabled and aria-disabled.
inset?boolean
Indents it to line up with items that have an icon or indicator.
label?string
The item's text, in place of Open in and the app's name.
shortcut?string
A keyboard shortcut like "mod+n". Shows ⌘N on Apple platforms and Ctrl+N elsewhere, and sets aria-keyshortcuts.
value?string
Passed to onAction when the item runs.
Default
chatgpt
variant?"default" | "destructive"
The visual style.
Type
"default" | "destructive"
class?string
Merged with the part's classes.
EventType
@select(event: Event) → unknown
Runs when the item is selected, by pointer or keyboard, with the event that selected it, or a new select Event when no DOM event did. Call event.preventDefault() to keep the menu open and skip onAction. Return a Promise to mark the item pending until it settles, like onAction.
Parameters
event – Event
Returns
unknown
OpenInClaude
PropType
closeOnSelect?boolean
Whether running the item closes the menu.
Default
true
destructive?boolean
Styles the item as dangerous, like Delete. Sets data-destructive.
disabled?boolean
Keeps the item focusable but stops it from running, as the menu pattern asks. Sets data-disabled and aria-disabled.
inset?boolean
Indents it to line up with items that have an icon or indicator.
label?string
The item's text, in place of Open in and the app's name.
shortcut?string
A keyboard shortcut like "mod+n". Shows ⌘N on Apple platforms and Ctrl+N elsewhere, and sets aria-keyshortcuts.
value?string
Passed to onAction when the item runs.
Default
claude
variant?"default" | "destructive"
The visual style.
Type
"default" | "destructive"
class?string
Merged with the part's classes.
EventType
@select(event: Event) → unknown
Runs when the item is selected, by pointer or keyboard, with the event that selected it, or a new select Event when no DOM event did. Call event.preventDefault() to keep the menu open and skip onAction. Return a Promise to mark the item pending until it settles, like onAction.
Parameters
event – Event
Returns
unknown
OpenInT3
PropType
closeOnSelect?boolean
Whether running the item closes the menu.
Default
true
destructive?boolean
Styles the item as dangerous, like Delete. Sets data-destructive.
disabled?boolean
Keeps the item focusable but stops it from running, as the menu pattern asks. Sets data-disabled and aria-disabled.
inset?boolean
Indents it to line up with items that have an icon or indicator.
label?string
The item's text, in place of Open in and the app's name.
shortcut?string
A keyboard shortcut like "mod+n". Shows ⌘N on Apple platforms and Ctrl+N elsewhere, and sets aria-keyshortcuts.
value?string
Passed to onAction when the item runs.
Default
t3
variant?"default" | "destructive"
The visual style.
Type
"default" | "destructive"
class?string
Merged with the part's classes.
EventType
@select(event: Event) → unknown
Runs when the item is selected, by pointer or keyboard, with the event that selected it, or a new select Event when no DOM event did. Call event.preventDefault() to keep the menu open and skip onAction. Return a Promise to mark the item pending until it settles, like onAction.
Parameters
event – Event
Returns
unknown
OpenInScira
PropType
closeOnSelect?boolean
Whether running the item closes the menu.
Default
true
destructive?boolean
Styles the item as dangerous, like Delete. Sets data-destructive.
disabled?boolean
Keeps the item focusable but stops it from running, as the menu pattern asks. Sets data-disabled and aria-disabled.
inset?boolean
Indents it to line up with items that have an icon or indicator.
label?string
The item's text, in place of Open in and the app's name.
shortcut?string
A keyboard shortcut like "mod+n". Shows ⌘N on Apple platforms and Ctrl+N elsewhere, and sets aria-keyshortcuts.
value?string
Passed to onAction when the item runs.
Default
scira
variant?"default" | "destructive"
The visual style.
Type
"default" | "destructive"
class?string
Merged with the part's classes.
EventType
@select(event: Event) → unknown
Runs when the item is selected, by pointer or keyboard, with the event that selected it, or a new select Event when no DOM event did. Call event.preventDefault() to keep the menu open and skip onAction. Return a Promise to mark the item pending until it settles, like onAction.
Parameters
event – Event
Returns
unknown
OpenInv0
PropType
closeOnSelect?boolean
Whether running the item closes the menu.
Default
true
destructive?boolean
Styles the item as dangerous, like Delete. Sets data-destructive.
disabled?boolean
Keeps the item focusable but stops it from running, as the menu pattern asks. Sets data-disabled and aria-disabled.
inset?boolean
Indents it to line up with items that have an icon or indicator.
label?string
The item's text, in place of Open in and the app's name.
shortcut?string
A keyboard shortcut like "mod+n". Shows ⌘N on Apple platforms and Ctrl+N elsewhere, and sets aria-keyshortcuts.
value?string
Passed to onAction when the item runs.
Default
v0
variant?"default" | "destructive"
The visual style.
Type
"default" | "destructive"
class?string
Merged with the part's classes.
EventType
@select(event: Event) → unknown
Runs when the item is selected, by pointer or keyboard, with the event that selected it, or a new select Event when no DOM event did. Call event.preventDefault() to keep the menu open and skip onAction. Return a Promise to mark the item pending until it settles, like onAction.
Parameters
event – Event
Returns
unknown
OpenInCursor
PropType
closeOnSelect?boolean
Whether running the item closes the menu.
Default
true
destructive?boolean
Styles the item as dangerous, like Delete. Sets data-destructive.
disabled?boolean
Keeps the item focusable but stops it from running, as the menu pattern asks. Sets data-disabled and aria-disabled.
inset?boolean
Indents it to line up with items that have an icon or indicator.
label?string
The item's text, in place of Open in and the app's name.
shortcut?string
A keyboard shortcut like "mod+n". Shows ⌘N on Apple platforms and Ctrl+N elsewhere, and sets aria-keyshortcuts.
value?string
Passed to onAction when the item runs.
Default
cursor
variant?"default" | "destructive"
The visual style.
Type
"default" | "destructive"
class?string
Merged with the part's classes.
EventType
@select(event: Event) → unknown
Runs when the item is selected, by pointer or keyboard, with the event that selected it, or a new select Event when no DOM event did. Call event.preventDefault() to keep the menu open and skip onAction. Return a Promise to mark the item pending until it settles, like onAction.