Buttons
External Link Button
An external link that names its destination host before the click and adds a hidden 'opens in a new tab' note.
- link
- external
- navigation
- security
Preview
Use it with AI
- 1. Copy the link.
- 2. Write to your agent in your own words and drop the link into the sentence.
- 3. The agent opens the link and installs the component from the registry.
put this in the header: https://vibeui.ru/c/button-047?lang=en
Show the full instructions
What the link says, spelled out. Use it when your agent cannot open links — paste this text instead.
# Install and place "button-047" (External Link Button) from VibeUI
## 1. Install first — do not skip, do not recreate
Run this exact command before writing any code:
npx shadcn@latest add https://vibeui.ru/r/button-047.json
Registry item: https://vibeui.ru/r/button-047.json
Installs to: components/vibeui/button-047.tsx (the exact path follows this project's components.json aliases).
npm dependencies: none.
Registry dependencies: none.
Install it from the registry. Do not recreate it from the description,
do not substitute a similar component from another library, and do not
rewrite it to match the project's existing style.
## 2. What it is
An external link that names its destination host before the click and adds a hidden 'opens in a new tab' note.
A link button that is honest about its destination: a monospace chip beside the label carries the host, and an exit mark on the right slides diagonally on hover. A hidden note tells screen reader users about the new tab, which target alone never announces. Zero dependencies, one file.
## 3. How to use it
import { Button047 } from "@/components/vibeui/button-047"
<Button047 href="https://ui.shadcn.com/docs">shadcn documentation</Button047>
Read the installed file for the full prop list.
## 4. Where to place it
This is a small inline component. Put it exactly where the user asked,
inside the existing markup. Do not create a new page, section or
wrapper for it. If a similar control already sits in that spot,
replace it instead of adding a second one.
Placement: ___
(The user fills this line in. If it is still blank, ask where to put it
instead of guessing.)
## 5. Keep exactly as installed
- a real <a> with href: a click handler loses copy-link, middle click and the status-bar preview
- rel="noreferrer noopener" next to target="_blank" — that is protection for the opening page, not decoration
- the hidden 'opens in a new tab' note: target on its own tells a screen reader nothing
- the host chip: it answers the question of where you are going before the click
- the diagonal slide of the exit mark — the outward direction reads through movement
- the light surface with a border, on which the dark label stays visible
## 6. You may change
- the link label
- the address through the href prop, which also supplies the host
- whether the host shows, through the showHost prop
- the accent colour through the accent prop
- the rest of the native anchor props: download, hrefLang, aria-*
## 7. Rules
- Do not replace the link with a <button> calling window.open: browsers block such windows and the context menu is lost.
- Do not drop rel with target="_blank" — the opened page gains access to window.opener.
- Do not put unchecked user input into href: a javascript: URL there is dangerous.
- Do not lift the CSS variables into globals.css: the component has to stay a single file.
## 8. Verify
- it renders with no console errors;
- it looks like the preview on the VibeUI page you copied this from;
- if it does not, you changed something listed in section 5 — put it back.For developers
npx shadcn@latest add https://vibeui.ru/r/button-047.jsonhttps://vibeui.ru/r/button-047.jsonКомпонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-button-047-*. Серверный компонент, корень — настоящий <a> с target="_blank" и rel="noreferrer noopener": адрес можно скопировать, открыть в новой вкладке и увидеть в строке состояния. Домен вынимается из href через URL с запасным разбором строки. Значок «стрелка из рамки» нарисован гранями псевдоэлементов; скрытая строка для скринридера спрятана clip-path.
Component source
The same file your agent installs. Here in case you would rather copy it by hand.
import type { ComponentPropsWithoutRef, CSSProperties } from "react"
export type Button047Props = ComponentPropsWithoutRef<"a"> & {
href?: string
/** Показывать домен назначения рядом с подписью. */
showHost?: boolean
accent?: string
}
// Идея компонента: ссылка, которая честно предупреждает об уходе с сайта.
// Домен вынимается из href прямо в разметку, значок «стрелка из рамки»
// нарисован гранями псевдоэлементов, а для скринридера к подписи добавлена
// скрытая строка «откроется в новой вкладке» — target сам по себе её не даёт.
const STYLES = `
:where([data-vibeui-block="button-047"]){
--vibeui-button-047-surface:oklch(1 0 0);
--vibeui-button-047-border:oklch(0.9 0.006 265);
--vibeui-button-047-fg:oklch(0.26 0.02 265);
--vibeui-button-047-muted:oklch(0.55 0.014 265);
--vibeui-button-047-accent:oklch(0.5 0.16 245);
--vibeui-button-047-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
--vibeui-button-047-mono:ui-monospace,SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace;
}
[data-vibeui-block="button-047"]{
position:relative;
display:inline-flex;align-items:center;gap:0.625rem;box-sizing:border-box;
height:2.625rem;padding:0 0.875rem;border-radius:0.625rem;
border:1px solid var(--vibeui-button-047-border);
background:var(--vibeui-button-047-surface);color:var(--vibeui-button-047-fg);
font-family:var(--vibeui-button-047-font);font-size:0.875rem;font-weight:600;line-height:1;
text-decoration:none;
transition:border-color .16s ease,color .16s ease;
}
[data-vibeui-block="button-047"]:hover{border-color:var(--vibeui-button-047-accent);color:var(--vibeui-button-047-accent)}
[data-vibeui-block="button-047"]:focus-visible{outline:2px solid var(--vibeui-button-047-accent);outline-offset:2px}
[data-vibeui-block="button-047"] [data-part="host"]{
font-family:var(--vibeui-button-047-mono);font-size:0.75rem;font-weight:500;
color:var(--vibeui-button-047-muted);
padding:0.1875rem 0.375rem;border-radius:0.3125rem;
background:color-mix(in oklab,var(--vibeui-button-047-accent) 8%,transparent);
}
/* Стрелка, выходящая из рамки: рамка — грани без правого верхнего угла. */
[data-vibeui-block="button-047"] [data-part="out"]{position:relative;flex:none;width:0.875rem;height:0.875rem}
[data-vibeui-block="button-047"] [data-part="out"]::before{
content:"";position:absolute;left:0;bottom:0;width:0.6875rem;height:0.6875rem;
box-sizing:border-box;border:1.5px solid currentColor;border-radius:0.1875rem;
border-top-color:transparent;border-right-color:transparent;
}
[data-vibeui-block="button-047"] [data-part="out"]::after{
content:"";position:absolute;right:0;top:0;width:0.5625rem;height:0.5625rem;
box-sizing:border-box;border:1.5px solid currentColor;border-left:0;border-bottom:0;
background:linear-gradient(45deg,transparent 46%,currentColor 46% 54%,transparent 54%);
}
[data-vibeui-block="button-047"] [data-part="out"]{transition:transform .18s cubic-bezier(0.16,1,0.3,1)}
[data-vibeui-block="button-047"]:hover [data-part="out"]{transform:translate(2px,-2px)}
[data-vibeui-block="button-047"] [data-part="sr"]{
position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;
}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="button-047"] *{animation:none!important;transition:none!important}}
`
function hostOf(href: string) {
try {
return new URL(href).host.replace(/^www\./, "")
} catch {
return href.replace(/^https?:\/\//, "").split("/")[0]
}
}
/**
* Ссылка на внешний ресурс со значком выхода и доменом назначения.
* Один файл, ноль зависимостей, собственная палитра.
*/
export function Button047({
href = "https://ui.shadcn.com/docs",
showHost = true,
accent,
className,
style,
children = "Документация shadcn",
...props
}: Button047Props) {
const palette = {
...(accent ? { "--vibeui-button-047-accent": accent } : null),
...style,
} as CSSProperties
return (
<>
<style href="vibeui-button-047" precedence="medium">
{STYLES}
</style>
<a
{...props}
href={href}
target="_blank"
rel="noreferrer noopener"
data-vibeui-block="button-047"
className={className}
style={palette}
>
<span data-part="label">{children}</span>
{showHost ? <span data-part="host">{hostOf(href)}</span> : null}
<span data-part="out" aria-hidden="true" />
<span data-part="sr">(откроется в новой вкладке)</span>
</a>
</>
)
}