Buttons

Download Button

A download button whose progress fills its own surface: status and percentage are driven from outside. Self-contained — one file, no dependencies.

  • button
  • download
  • progress
  • status
  • async

Preview

1440pxHost theme

Use it with AI

  1. 1. Copy the link.
  2. 2. Write to your agent in your own words and drop the link into the sentence.
  3. 3. The agent opens the link and installs the component from the registry.
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-010" (Download Button) from VibeUI

## 1. Install first — do not skip, do not recreate
Install command is unavailable: the VibeUI registry URL is not configured.

Installs to: components/vibeui/button-010.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 button whose progress fills its own surface: status and percentage are driven from outside. Self-contained — one file, no dependencies.

A download button with the progress inside its own surface. At rest it is a dark button with a down arrow that hops on hover. While loading, the background fills left to right by percentage, the label shows the number in tabular figures, and the button locks and gains aria-busy. When done, the fill turns green and a checkmark replaces the arrow.

## 3. How to use it
import { Button010 } from "@/components/vibeui/button-010"

<Button010 status={status} progress={percent} onClick={startDownload}>
  Download report
</Button010>

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 progress filling the button's own surface rather than a separate bar beside it — that is the idea of the component
- the three states idle / loading / done and a distinct label for each
- the lock and aria-busy while loading: a second click must not go through
- tabular-nums on the percentage, otherwise the button's width jumps at every step
- the fill colour change on done and the checkmark replacing the arrow
- the left transform-origin on the fill: progress grows from the left edge

## 6. You may change
- the children, loadingLabel and doneLabel labels
- the fill colour through the accent prop
- the onClick handler
- outer spacing through className
- the status prop: idle, loading or done — the component never switches it on its own
- the progress value from 0 to 100 — it comes from outside, the button downloads nothing

## 7. Rules
- The component does not download anything: status and progress come from outside. Do not add a fetch inside it and do not give it internal loading state.
- Do not leave status on loading without updating progress — the fill freezes and reads as a hang.
- 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

The install command is unavailable: the environment variableREGISTRY_BASE_URL

Компонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-button-010-*. Прогресс приходит пропами status и progress — компонент ничего не качает сам и не знает про сеть. В состоянии loading кнопка становится disabled и получает aria-busy.

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 Button010Status = "idle" | "loading" | "done"

export type Button010Props = ComponentPropsWithoutRef<"button"> & {
  status?: Button010Status
  /** 0–100. Управляется снаружи: компонент ничего не качает сам. */
  progress?: number
  loadingLabel?: string
  doneLabel?: string
  accent?: string
}

// Идея компонента: прогресс живёт в самой подложке кнопки, а не в отдельной
// полосе рядом. Заливка растёт слева направо по ширине кнопки, подпись
// меняется по статусу, в конце появляется галочка. Прогресс приходит снаружи
// пропом — компонент не знает про сеть и ничего не качает сам.
const STYLES = `
:where([data-vibeui-block="button-010"]){
--vibeui-button-010-bg:oklch(0.24 0.014 265);
--vibeui-button-010-fg:oklch(0.98 0.003 265);
--vibeui-button-010-fill:oklch(0.55 0.14 250);
--vibeui-button-010-done:oklch(0.6 0.14 158);
--vibeui-button-010-ring:oklch(0.72 0.012 265);
--vibeui-button-010-radius:0.625rem;
--vibeui-button-010-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
[data-vibeui-block="button-010"]{
position:relative;overflow:hidden;isolation:isolate;appearance:none;border:0;cursor:pointer;
display:inline-flex;align-items:center;justify-content:center;gap:0.5rem;
height:2.5rem;padding:0 1.125rem;border-radius:var(--vibeui-button-010-radius);
font-family:var(--vibeui-button-010-font);font-size:0.875rem;font-weight:500;line-height:1;
background:var(--vibeui-button-010-bg);color:var(--vibeui-button-010-fg);
font-variant-numeric:tabular-nums;
transition:background-color .2s ease;
}
[data-vibeui-block="button-010"] [data-part="fill"]{
position:absolute;inset:0;z-index:-1;transform-origin:left center;
background:var(--vibeui-button-010-fill);
transition:transform .3s cubic-bezier(0.16,1,0.3,1),background-color .25s ease;
}
[data-vibeui-block="button-010"][data-status="done"] [data-part="fill"]{background:var(--vibeui-button-010-done)}
[data-vibeui-block="button-010"][data-status="idle"]:hover:not(:disabled){background:color-mix(in oklab, var(--vibeui-button-010-bg) 82%, white)}
[data-vibeui-block="button-010"] svg{width:0.875rem;height:0.875rem;flex:none}
[data-vibeui-block="button-010"] [data-part="arrow"]{transition:transform .22s cubic-bezier(0.16,1,0.3,1)}
[data-vibeui-block="button-010"][data-status="idle"]:hover:not(:disabled) [data-part="arrow"]{transform:translateY(2px)}
[data-vibeui-block="button-010"]:focus-visible{outline:2px solid var(--vibeui-button-010-ring);outline-offset:2px}
[data-vibeui-block="button-010"]:disabled{cursor:not-allowed;opacity:.7}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="button-010"] *{transition:none!important}}
`

function clampPercent(value: number): number {
  return Math.min(100, Math.max(0, value))
}

/**
 * Кнопка загрузки: прогресс заливает подложку кнопки. Один файл, ноль
 * зависимостей, собственная палитра.
 */
export function Button010({
  status = "idle",
  progress = 0,
  loadingLabel = "Загружаем…",
  doneLabel = "Готово",
  accent,
  type = "button",
  disabled,
  className,
  style,
  children = "Скачать отчёт",
  ...props
}: Button010Props) {
  const percent =
    status === "done" ? 100 : status === "loading" ? clampPercent(progress) : 0

  const palette = {
    ...(accent ? { "--vibeui-button-010-fill": accent } : null),
    ...style,
  } as CSSProperties

  return (
    <>
      <style href="vibeui-button-010" precedence="medium">
        {STYLES}
      </style>
      <button
        {...props}
        type={type}
        data-vibeui-block="button-010"
        data-status={status}
        disabled={disabled || status === "loading"}
        aria-busy={status === "loading" || undefined}
        className={className}
        style={palette}
      >
        <span
          data-part="fill"
          aria-hidden="true"
          style={{ transform: `scaleX(${percent / 100})` }}
        />
        {status === "idle" ? (
          <svg
            data-part="arrow"
            viewBox="0 0 14 14"
            fill="none"
            aria-hidden="true"
          >
            <path
              d="M7 1v9m0 0 3.5-3.5M7 10 3.5 6.5M1.5 12.5h11"
              stroke="currentColor"
              strokeWidth="1.6"
              strokeLinecap="round"
              strokeLinejoin="round"
            />
          </svg>
        ) : null}
        {status === "done" ? (
          <svg viewBox="0 0 14 14" fill="none" aria-hidden="true">
            <path
              d="m2 7.5 3.5 3.5L12 3.5"
              stroke="currentColor"
              strokeWidth="1.8"
              strokeLinecap="round"
              strokeLinejoin="round"
            />
          </svg>
        ) : null}
        {status === "loading"
          ? `${loadingLabel} ${clampPercent(progress)}%`
          : status === "done"
            ? doneLabel
            : children}
      </button>
    </>
  )
}