Buttons
File Download Link
A download link that names the weight and the format before the click: an extension chip, the file name and the size beside it. A real <a download>, not a button.
- button
- download
- link
- file
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-026?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-026" (File Download Link) 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-026.json
Registry item: https://vibeui.ru/r/button-026.json
Installs to: components/vibeui/button-026.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
A download link that names the weight and the format before the click: an extension chip, the file name and the size beside it. A real <a download>, not a button.
A download link shaped like a button, with the file described on it. On the left an extension chip recoloured per format, in the middle the name, under it the format and the weight — the pair people use to decide between now and later. The arrow dips a couple of pixels on hover. This is a real link with download, not a button with a handler.
## 3. How to use it
import { Button026 } from "@/components/vibeui/button-026"
<Button026
href="/files/report-march.pdf"
fileName="report-march.pdf"
label="March report"
size="2.4 MB"
/>
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
- the <a> tag with the download attribute instead of a button: otherwise middle-click, save-as and copying the address are all lost
- the weight and the format next to the name — that is the reason this component exists
- the extension chip and its recolouring through data-format: the format registers before the name is read
- the single-line ellipsis on a long name — the card has to keep one height
- the aria-label carrying name, format and weight: the meta line is aria-hidden so nothing is announced twice
- tabular-nums on the weight, otherwise the digits dance as the value changes
## 6. You may change
- the caption through the label prop
- the address through href and the file name through fileName, which drives the format chip
- the weight through the size prop: the server computes it, the component only prints the string
- the accent colour through the accent prop
- the card width through className, the built-in maximum is 20rem
## 7. Rules
- The download attribute is ignored for cross-origin files: the browser simply opens them. Serve external files through your own domain.
- Do not put unknown into size: with no weight it is better to drop the line than to lie about it.
- Do not turn the link into a button with a programmatic download — that throws away everything the <a> tag was taken for.
- 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-026.jsonhttps://vibeui.ru/r/button-026.jsonКомпонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-button-026-*. Серверный: хуков нет. Корень — тег <a> с атрибутом download, поэтому работают средняя кнопка мыши, «сохранить как» и копирование адреса. Формат вычисляется из расширения fileName и уходит в data-format, который перекрашивает плашку. Размер приходит строкой: считать вес файла — работа сервера.
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 Button026Props = Omit<
ComponentPropsWithoutRef<"a">,
"children" | "download"
> & {
label?: string
/** Имя файла: из него берутся значок формата и атрибут download. */
fileName?: string
/** Размер строкой — его считает сервер, а не кнопка. */
size?: string
accent?: string
}
// Идея компонента: перед скачиванием человек хочет знать, что именно
// прилетит. Это настоящая ссылка с атрибутом download, а не button: работают
// средняя кнопка мыши, «сохранить как» и копирование адреса. Формат берётся
// из расширения имени файла и рисуется плашкой, вес стоит рядом — по этой
// паре решают, качать ли сейчас или с вайфая.
const STYLES = `
:where([data-vibeui-block="button-026"]){
--vibeui-button-026-bg:oklch(1 0 0);
--vibeui-button-026-fg:oklch(0.26 0.016 265);
--vibeui-button-026-muted:oklch(0.55 0.014 265);
--vibeui-button-026-border:oklch(0.9 0.006 265);
--vibeui-button-026-accent:oklch(0.55 0.17 265);
--vibeui-button-026-badge:oklch(0.55 0.19 25);
--vibeui-button-026-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
[data-vibeui-block="button-026"]{
display:flex;align-items:center;gap:0.75rem;text-decoration:none;
width:100%;max-width:20rem;padding:0.625rem 0.875rem;box-sizing:border-box;
border:1px solid var(--vibeui-button-026-border);border-radius:0.75rem;
background:var(--vibeui-button-026-bg);color:var(--vibeui-button-026-fg);
font-family:var(--vibeui-button-026-font);
transition:border-color .16s ease,transform .16s ease;
}
[data-vibeui-block="button-026"]:hover{border-color:var(--vibeui-button-026-accent)}
[data-vibeui-block="button-026"]:focus-visible{outline:2px solid var(--vibeui-button-026-accent);outline-offset:2px}
/* Плашка формата: расширение читается быстрее, чем хвост имени файла. */
[data-vibeui-block="button-026"] [data-part="badge"]{
flex:none;display:inline-flex;align-items:center;justify-content:center;
width:2.25rem;height:2.5rem;border-radius:0.375rem;
background:color-mix(in oklab,var(--vibeui-button-026-badge) 12%,transparent);
color:var(--vibeui-button-026-badge);
font-size:0.625rem;font-weight:750;letter-spacing:0.04em;
}
[data-vibeui-block="button-026"][data-format="zip"]{--vibeui-button-026-badge:oklch(0.6 0.14 75)}
[data-vibeui-block="button-026"][data-format="csv"]{--vibeui-button-026-badge:oklch(0.52 0.14 152)}
[data-vibeui-block="button-026"][data-format="png"]{--vibeui-button-026-badge:oklch(0.55 0.15 300)}
[data-vibeui-block="button-026"] [data-part="text"]{display:flex;flex-direction:column;gap:0.1875rem;min-width:0}
[data-vibeui-block="button-026"] [data-part="title"]{
font-size:0.875rem;font-weight:650;line-height:1.2;
white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
[data-vibeui-block="button-026"] [data-part="meta"]{
color:var(--vibeui-button-026-muted);font-size:0.75rem;line-height:1.2;
font-variant-numeric:tabular-nums;
}
[data-vibeui-block="button-026"] [data-part="arrow"]{
flex:none;margin-left:auto;position:relative;width:0.875rem;height:1rem;
color:var(--vibeui-button-026-accent);
transition:transform .16s ease;
}
[data-vibeui-block="button-026"] [data-part="arrow"]::before{
content:"";position:absolute;left:50%;top:0;width:2px;height:0.6875rem;
margin-left:-1px;border-radius:1px;background:currentColor;
}
[data-vibeui-block="button-026"] [data-part="arrow"]::after{
content:"";position:absolute;left:50%;top:0.3125rem;width:0.5rem;height:0.5rem;
margin-left:-0.25rem;box-sizing:border-box;
border-right:2px solid currentColor;border-bottom:2px solid currentColor;
transform:rotate(45deg);
}
[data-vibeui-block="button-026"]:hover [data-part="arrow"]{transform:translateY(2px)}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="button-026"] *{animation:none!important;transition:none!important}}
`
function formatOf(fileName: string) {
const dot = fileName.lastIndexOf(".")
return dot > 0 ? fileName.slice(dot + 1).toLowerCase() : "file"
}
/**
* Ссылка-кнопка скачивания: формат, имя и вес файла видны до клика.
* Один файл, ноль зависимостей, собственная палитра.
*/
export function Button026({
label = "Отчёт за март",
fileName = "vibeui-report-march.pdf",
size = "2,4 МБ",
accent,
href = "#",
className,
style,
...props
}: Button026Props) {
const format = formatOf(fileName)
const palette = {
...(accent ? { "--vibeui-button-026-accent": accent } : null),
...style,
} as CSSProperties
return (
<>
<style href="vibeui-button-026" precedence="medium">
{STYLES}
</style>
<a
{...props}
href={href}
download={fileName}
data-vibeui-block="button-026"
data-format={format}
className={className}
style={palette}
aria-label={`${label}, ${format.toUpperCase()}, ${size}`}
>
<span data-part="badge" aria-hidden="true">
{format.toUpperCase()}
</span>
<span data-part="text">
<span data-part="title">{label}</span>
<span data-part="meta" aria-hidden="true">
{format.toUpperCase()} · {size}
</span>
</span>
<span data-part="arrow" aria-hidden="true" />
</a>
</>
)
}