Feedback

Offline Banner

An offline bar that explains the consequences: not just «offline», but what happens to the text you already typed.

  • banner
  • offline
  • network
  • 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/banner-006?lang=en

No connection to the serverИзменения сохраняются в браузере и уйдут сами, как только сеть вернётся.
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 "banner-006" (Offline Banner) 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/banner-006.json

Registry item: https://vibeui.ru/r/banner-006.json
Installs to: components/vibeui/banner-006.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 offline bar that explains the consequences: not just «offline», but what happens to the text you already typed.

An offline bar: a signal indicator, the consequences and a retry action. Zero dependencies, one file, no client JS.

## 3. How to use it
import { Banner006 } from "@/components/vibeui/banner-006"

<Banner006
  message="No connection to the server"
  detail="Changes are kept in the browser."
  retryLabel="Check network"
/>

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-banner-006-* palette — do not swap it for your theme tokens
- the second line about consequences: "no connection" alone leaves people fearing for their text
- the shape of the indicator: a broken signal must read without colour
- role="status" with aria-live="polite" — losing the network is announced but does not interrupt typing
- the dark surface: the bar has to look different from ordinary interface messages
- the @container rule on the inner shell — a container query never applies to the container itself

## 6. You may change
- the first line through message and the second through detail
- the action caption through retryLabel
- the indicator colour through the --vibeui-banner-006-tone variable
- the bar width through max-width on the root

## 7. Rules
- The component does not watch the network: the app decides when to show and hide the bar.
- The promise "saved in the browser" must be true — otherwise rewrite the copy.
- The button only calls onRetry: the retry request is the caller's job.
- 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/banner-006.json
https://vibeui.ru/r/banner-006.json

Компонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-banner-006-*. Серверный: хуков нет. Индикатор — три чёрточки разной высоты, они гаснут по очереди через animation-delay, а последняя приглушена постоянно: оборванный сигнал читается по форме, а не только по цвету. Полоса тёмная и объявлена role="status" с aria-live="polite". Раскладка считается от собственной ширины: @container на внутреннем shell растягивает кнопку на узком экране.

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 Banner006Props = Omit<
  ComponentPropsWithoutRef<"div">,
  "children"
> & {
  message?: string
  /** Что происходит с несохранённым: без этой строки полоса бесполезна. */
  detail?: string
  retryLabel?: string
  onRetry?: () => void
}

// Идея компонента: полоса «нет сети», которая объясняет последствия. Не просто
// «офлайн», а что будет с набранным текстом. Индикатор слева — три затухающие
// чёрточки, они читаются как оборванный сигнал даже без цвета.
const STYLES = `
:where([data-vibeui-block="banner-006"]){
--vibeui-banner-006-bg:oklch(0.25 0.012 265);
--vibeui-banner-006-fg:oklch(0.96 0.002 265);
--vibeui-banner-006-muted:oklch(0.75 0.008 265);
--vibeui-banner-006-tone:oklch(0.78 0.13 75);
--vibeui-banner-006-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
container-type:inline-size;
}
[data-vibeui-block="banner-006"]{
width:100%;box-sizing:border-box;
font-family:var(--vibeui-banner-006-font);color:var(--vibeui-banner-006-fg);
}
[data-vibeui-block="banner-006"] [data-part="shell"]{
display:flex;align-items:center;gap:0.875rem;flex-wrap:wrap;
box-sizing:border-box;padding:0.75rem 1rem;
border-radius:0.875rem;background:var(--vibeui-banner-006-bg);
}
/* Три чёрточки гаснут по очереди: оборванный сигнал читается без цвета. */
[data-vibeui-block="banner-006"] [data-part="signal"]{
display:flex;align-items:flex-end;gap:0.125rem;flex:none;height:0.875rem;
}
[data-vibeui-block="banner-006"] [data-part="signal"] i{
display:block;width:0.1875rem;border-radius:0.0625rem;
background:var(--vibeui-banner-006-tone);
animation:vibeui-banner-006-fade 1.8s ease-in-out infinite;
}
[data-vibeui-block="banner-006"] [data-part="signal"] i:nth-child(1){height:0.375rem}
[data-vibeui-block="banner-006"] [data-part="signal"] i:nth-child(2){height:0.625rem;animation-delay:.2s}
[data-vibeui-block="banner-006"] [data-part="signal"] i:nth-child(3){height:0.875rem;animation-delay:.4s;opacity:.35}
@keyframes vibeui-banner-006-fade{0%,100%{opacity:1}50%{opacity:.25}}
[data-vibeui-block="banner-006"] [data-part="text"]{display:flex;flex-direction:column;gap:0.125rem;flex:1 1 14rem;min-width:0}
[data-vibeui-block="banner-006"] [data-part="message"]{font-size:0.875rem;font-weight:640;line-height:1.35}
[data-vibeui-block="banner-006"] [data-part="detail"]{font-size:0.8125rem;line-height:1.45;color:var(--vibeui-banner-006-muted)}
[data-vibeui-block="banner-006"] [data-part="retry"]{
appearance:none;cursor:pointer;flex:none;
height:2rem;padding:0 0.875rem;border-radius:0.5rem;
border:1px solid oklch(1 0 0 / 26%);background:transparent;
color:var(--vibeui-banner-006-fg);
font:inherit;font-size:0.8125rem;font-weight:640;
transition:background-color .16s ease;
}
[data-vibeui-block="banner-006"] [data-part="retry"]:hover{background:oklch(1 0 0 / 12%)}
[data-vibeui-block="banner-006"] [data-part="retry"]:focus-visible{outline:2px solid var(--vibeui-banner-006-tone);outline-offset:2px}
@container (max-width: 24rem){
[data-vibeui-block="banner-006"] [data-part="retry"]{width:100%}
}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="banner-006"] *{animation:none!important;transition:none!important}}
`

/**
 * Полоса офлайн-состояния: индикатор сигнала, последствия и повтор.
 * Один файл, ноль зависимостей, собственная палитра.
 */
export function Banner006({
  message = "Нет соединения с сервером",
  detail = "Изменения сохраняются в браузере и уйдут сами, как только сеть вернётся.",
  retryLabel = "Проверить сеть",
  onRetry,
  className,
  style,
  ...props
}: Banner006Props) {
  return (
    <>
      <style href="vibeui-banner-006" precedence="medium">
        {STYLES}
      </style>
      <div
        {...props}
        data-vibeui-block="banner-006"
        role="status"
        aria-live="polite"
        className={className}
        style={style as CSSProperties}
      >
        <div data-part="shell">
          <span data-part="signal" aria-hidden="true">
            <i />
            <i />
            <i />
          </span>
          <span data-part="text">
            <span data-part="message">{message}</span>
            {detail ? <span data-part="detail">{detail}</span> : null}
          </span>
          {retryLabel ? (
            <button data-part="retry" type="button" onClick={onRetry}>
              {retryLabel}
            </button>
          ) : null}
        </div>
      </div>
    </>
  )
}