Inputs

Retry Upload

A failed upload with a way out: it names the cause rather than "upload error", and the retry sits right there — the file is still selected.

  • file
  • upload
  • error
  • retry

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.

put this in the header: https://vibeui.ru/c/file-010?lang=en

pitch-deck.keyConnection dropped at 82% — the file arrived partly

Файл остался выбранным — при повторе его не нужно искать заново.

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 "file-010" (Retry Upload) 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/file-010.json

Registry item: https://vibeui.ru/r/file-010.json
Installs to: components/vibeui/file-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 failed upload with a way out: it names the cause rather than "upload error", and the retry sits right there — the file is still selected.

A row for a failed upload: the cause in words, a retry button beside it and three states — failed, retrying, done. The file stays selected, so a retry does not send you hunting for it again. Zero dependencies, one file, its own palette.

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

<File010
  fileName="pitch-deck.key"
  reason="Connection dropped at 82%"
  onRetry={() => upload()}
/>

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 local --vibeui-file-010-* palette — do not swap it for your theme tokens (bg-destructive, bg-muted and the like)
- the cause instead of "upload error": it shows whether a retry helps or the file has to change
- the retry button inside the row — a dropped connection is no reason to look for the file again
- three states with their own glyphs: failed, waiting and done differ in shape, not only in colour
- the state text in role="status": a glyph alone is not read aloud
- the file name in the retry button label — in a list of rows a bare "retry" means nothing
- the <style> block inside the component — it holds the palette, the glyphs and the waiting animation

## 6. You may change
- the fileName and the reason text
- the retryLabel button caption
- the onRetry handler: kick off the real re-upload there
- the accent through the accent prop — it colours the waiting ring
- the waiting and success wording

## 7. Rules
- Success after a second and a half is a demo. In a real project the server response drives the state and the timer goes away.
- Retry only transient failures: "file too large" will not improve on the second try, it needs a different file.
- Do not retry endlessly on your own: several failures in a row mean a different path is needed, not one more attempt.
- 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/file-010.json
https://vibeui.ru/r/file-010.json

Компонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-file-010-*. Клиентский: "use client" ради повтора. Состояние строки выносится в data-status на корне: по нему рисуются крест, кольцо ожидания или галочка. Повтор переводит строку в состояние ожидания, а useEffect по таймеру доводит её до успеха — в настоящем проекте на месте таймера запрос. Текст состояния стоит в role="status", поэтому значок никогда не работает один.

Component source

The same file your agent installs. Here in case you would rather copy it by hand.

"use client"

import { useEffect, useState } from "react"
import type { ComponentPropsWithoutRef, CSSProperties } from "react"

export type File010Props = Omit<
  ComponentPropsWithoutRef<"div">,
  "children" | "onChange"
> & {
  fileName?: string
  reason?: string
  retryLabel?: string
  onRetry?: () => void
  accent?: string
}

// Идея компонента: сорванная загрузка, из которой есть выход. Красная строка
// без кнопки заставляет искать файл заново — а причина почти всегда временная:
// пропала сеть, сервер ответил пятисоткой. Здесь названа причина, а не «ошибка
// загрузки», и рядом стоит повтор: файл уже выбран, второй раз его искать не
// нужно. На время повтора строка честно показывает, что идёт работа.
const STYLES = `
:where([data-vibeui-block="file-010"]){
--vibeui-file-010-surface:oklch(1 0 0);
--vibeui-file-010-fg:oklch(0.23 0.014 265);
--vibeui-file-010-muted:oklch(0.55 0.014 265);
--vibeui-file-010-border:oklch(0.89 0.008 265);
--vibeui-file-010-shell:oklch(0.91 0.006 265);
--vibeui-file-010-track:oklch(0.93 0.006 265);
--vibeui-file-010-accent:oklch(0.54 0.17 260);
--vibeui-file-010-danger:oklch(0.55 0.19 25);
--vibeui-file-010-ok:oklch(0.52 0.13 155);
--vibeui-file-010-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
/* Своя светлая подложка: строку показывают поверх любого фона. */
[data-vibeui-block="file-010"]{
display:flex;flex-direction:column;gap:0.5rem;
width:100%;max-width:23rem;box-sizing:border-box;padding:0.875rem;
background:var(--vibeui-file-010-surface);
border:1px solid var(--vibeui-file-010-shell);border-radius:0.875rem;
font-family:var(--vibeui-file-010-font);color:var(--vibeui-file-010-fg);
}
[data-vibeui-block="file-010"] *{box-sizing:border-box}
[data-vibeui-block="file-010"] [data-part="row"]{
display:flex;align-items:center;gap:0.625rem;
padding:0.625rem;border-radius:0.75rem;
border:1px solid var(--vibeui-file-010-border);
transition:border-color .16s ease;
}
[data-vibeui-block="file-010"][data-status="failed"] [data-part="row"]{
border-color:color-mix(in oklab,var(--vibeui-file-010-danger) 50%,var(--vibeui-file-010-border));
background:color-mix(in oklab,var(--vibeui-file-010-danger) 5%,oklch(1 0 0));
}
[data-vibeui-block="file-010"][data-status="done"] [data-part="row"]{
border-color:color-mix(in oklab,var(--vibeui-file-010-ok) 45%,var(--vibeui-file-010-border));
}
[data-vibeui-block="file-010"] [data-part="mark"]{
position:relative;flex:none;width:1.75rem;height:1.75rem;border-radius:9999px;
background:var(--vibeui-file-010-track);
}
[data-vibeui-block="file-010"][data-status="failed"] [data-part="mark"]{background:var(--vibeui-file-010-danger)}
[data-vibeui-block="file-010"][data-status="done"] [data-part="mark"]{background:var(--vibeui-file-010-ok)}
[data-vibeui-block="file-010"][data-status="failed"] [data-part="mark"]::before,
[data-vibeui-block="file-010"][data-status="failed"] [data-part="mark"]::after{
content:"";position:absolute;left:0.5rem;top:0.8125rem;
width:0.75rem;height:2px;border-radius:9999px;background:oklch(1 0 0);
}
[data-vibeui-block="file-010"][data-status="failed"] [data-part="mark"]::before{transform:rotate(45deg)}
[data-vibeui-block="file-010"][data-status="failed"] [data-part="mark"]::after{transform:rotate(-45deg)}
[data-vibeui-block="file-010"][data-status="done"] [data-part="mark"]::before{
content:"";position:absolute;left:0.6875rem;top:0.4375rem;
width:0.375rem;height:0.6875rem;transform:rotate(42deg);
border-right:2px solid oklch(1 0 0);border-bottom:2px solid oklch(1 0 0);
}
[data-vibeui-block="file-010"][data-status="retrying"] [data-part="mark"]{
background:none;border:2px solid color-mix(in oklab,var(--vibeui-file-010-accent) 30%,transparent);
border-top-color:var(--vibeui-file-010-accent);
animation:vibeui-file-010-spin .7s linear infinite;
}
@keyframes vibeui-file-010-spin{to{transform:rotate(1turn)}}
[data-vibeui-block="file-010"] [data-part="body"]{display:flex;flex-direction:column;gap:0.125rem;min-width:0;flex:1}
[data-vibeui-block="file-010"] [data-part="name"]{
font-size:0.8125rem;font-weight:650;
overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
/* Причина, а не «ошибка загрузки»: по ней видно, поможет ли повтор. */
[data-vibeui-block="file-010"] [data-part="reason"]{
font-size:0.6875rem;line-height:1.4;color:var(--vibeui-file-010-muted);
}
[data-vibeui-block="file-010"][data-status="failed"] [data-part="reason"]{color:var(--vibeui-file-010-danger);font-weight:600}
[data-vibeui-block="file-010"] button{
appearance:none;flex:none;cursor:pointer;
padding:0.375rem 0.6875rem;border-radius:0.5rem;
border:1px solid var(--vibeui-file-010-danger);
background:none;color:var(--vibeui-file-010-danger);
font:inherit;font-size:0.75rem;font-weight:700;
transition:background-color .16s ease,color .16s ease;
}
[data-vibeui-block="file-010"] button:hover{background:var(--vibeui-file-010-danger);color:oklch(1 0 0)}
[data-vibeui-block="file-010"] button:focus-visible{outline:2px solid var(--vibeui-file-010-danger);outline-offset:2px}
[data-vibeui-block="file-010"] [data-part="hint"]{
margin:0;font-size:0.6875rem;line-height:1.4;color:var(--vibeui-file-010-muted);
}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="file-010"] *{animation:none!important;transition:none!important}}
`

type Status = "failed" | "retrying" | "done"

const REASONS: Record<Status, string> = {
  failed: "",
  retrying: "Повторяем отправку…",
  done: "Загружен со второй попытки",
}

/**
 * Строка сорванной загрузки: причина отказа и повтор без повторного выбора файла.
 * Один файл, ноль зависимостей, собственная палитра.
 */
export function File010({
  fileName = "презентация-инвесторам.key",
  reason = "Сеть пропала на 82% — файл дошёл не целиком",
  retryLabel = "Повторить",
  onRetry,
  accent,
  className,
  style,
  ...props
}: File010Props) {
  const [status, setStatus] = useState<Status>("failed")

  useEffect(() => {
    if (status !== "retrying") return

    const timer = window.setTimeout(() => setStatus("done"), 1200)

    return () => window.clearTimeout(timer)
  }, [status])

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

  return (
    <>
      <style href="vibeui-file-010" precedence="medium">
        {STYLES}
      </style>
      <div
        {...props}
        data-vibeui-block="file-010"
        data-status={status}
        className={className}
        style={palette}
      >
        <div data-part="row">
          <span data-part="mark" aria-hidden="true" />
          <span data-part="body">
            <span data-part="name">{fileName}</span>
            {/* Состояние словом: значок сам по себе не читается вслух. */}
            <span data-part="reason" role="status">
              {status === "failed" ? reason : REASONS[status]}
            </span>
          </span>
          {status === "failed" ? (
            <button
              type="button"
              aria-label={`${retryLabel}: ${fileName}`}
              onClick={() => {
                setStatus("retrying")
                onRetry?.()
              }}
            >
              {retryLabel}
            </button>
          ) : null}
        </div>
        <p data-part="hint">
          Файл остался выбранным — при повторе его не нужно искать заново.
        </p>
      </div>
    </>
  )
}