Alert

Countdown Alert

A deadline running out: the remainder large, the action beside it, and a bar under the text shrinking to zero. Three ways of saying one thing, because a line of text gets skipped.

  • alert
  • trial
  • countdown
  • deadline

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/alert-009?lang=en

3 daysYour trial is endingПосле 14 марта проект останется опубликованным, но редактирование выключится.Extend
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 "alert-009" (Countdown Alert) 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/alert-009.json

Registry item: https://vibeui.ru/r/alert-009.json
Installs to: components/vibeui/alert-009.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 deadline running out: the remainder large, the action beside it, and a bar under the text shrinking to zero. Three ways of saying one thing, because a line of text gets skipped.

An expiring-deadline alert: the remainder set large on the left, the explanation and a shrinking bar in the middle, the action on the right. The bar shows what is left rather than what has passed, so it contracts toward zero. The countdown is computed by the caller. Zero dependencies, one file, its own palette.

## 3. How to use it
import { Alert009 } from "@/components/vibeui/alert-009"

<Alert009
  remaining="3 days"
  elapsed={78}
  title="Your trial is ending"
  actionLabel="Extend"
/>

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-alert-009-* palette — do not swap it for your theme tokens (bg-warning, text-primary and the like)
- the bar as remainder rather than progress: a filling bar reads as approaching a goal, not an ending
- the large remainder in tabular figures: the number changes daily, the line width must not
- the three carriers of one meaning — number, text and bar: a line saying "3 days left" gets skipped
- the absence of an internal timer: a ticking render on every page costs more than a daily update from outside
- the @container query that moves the text onto its own line in a narrow column
- the <style> block inside the component — it holds the palette and the layout

## 6. You may change
- remaining — the remainder string: "3 days", "until 14 March", "2 hours"
- elapsed — the share of the period already gone, as a percentage
- the title and description copy
- actionLabel and actionHref — the action that resolves it
- the accent through the accent prop — it colours the remainder, the bar and the button

## 7. Rules
- remaining and elapsed have to agree: "3 days" at elapsed 10 reads as a data bug.
- Do not show the alert from day one of the period: it loses force long before the deadline.
- The component does no date maths. The gap between today and 14 March 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/alert-009.json
https://vibeui.ru/r/alert-009.json

Компонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-alert-009-*. Отсчёт не считается внутри: строка остатка и доля прошедшего срока приходят пропами, потому что таймер в компоненте означал бы тикающий рендер на каждой странице. Полоса показывает остаток, а не пройденное — её ширина считается как 100 минус elapsed. Левая граница окрашена в тон, а не вся рамка.

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 Alert009Props = Omit<
  ComponentPropsWithoutRef<"div">,
  "title" | "children"
> & {
  title?: string
  description?: string
  /** Крупная строка отсчёта: «3 дня», «до 14 марта». Считает вызывающий код. */
  remaining?: string
  /** Доля прошедшего срока, 0–100: полоса убывает от неё к нулю. */
  elapsed?: number
  actionLabel?: string
  actionHref?: string
  accent?: string
}

// Идея компонента: срок, который заканчивается. Слева крупная строка остатка,
// справа действие, снизу убывающая полоса — три способа сказать одно и то же,
// потому что «осталось 3 дня» пропускают, а сжимающуюся полосу замечают.
// Отсчёт считает вызывающий код: компонент не запускает таймеров.
const STYLES = `
:where([data-vibeui-block="alert-009"]){
--vibeui-alert-009-fg:oklch(0.24 0.016 265);
--vibeui-alert-009-muted:oklch(0.5 0.014 265);
--vibeui-alert-009-bg:oklch(1 0 0);
--vibeui-alert-009-border:oklch(0.9 0.006 265);
--vibeui-alert-009-track:oklch(0.93 0.006 265);
--vibeui-alert-009-accent:oklch(0.68 0.15 70);
--vibeui-alert-009-radius:0.875rem;
--vibeui-alert-009-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
container-type:inline-size;
}
[data-vibeui-block="alert-009"]{
/* flex-wrap живёт здесь, а не в @container: контейнерный запрос применяется
   к потомкам контейнера, но не к нему самому. На широкой раскладке перенос
   ни на что не влияет — всё умещается в строку. */
display:flex;flex-wrap:wrap;align-items:center;gap:0.625rem 1rem;
width:100%;box-sizing:border-box;
padding:0.9375rem 1.0625rem;
border:1px solid var(--vibeui-alert-009-border);
border-left:3px solid var(--vibeui-alert-009-accent);
border-radius:var(--vibeui-alert-009-radius);
background:var(--vibeui-alert-009-bg);color:var(--vibeui-alert-009-fg);
font-family:var(--vibeui-alert-009-font);
}
/* Остаток крупно и моноширинными: число меняется, ширина строки — нет. */
[data-vibeui-block="alert-009"] [data-part="remaining"]{
flex:none;font-size:1.25rem;font-weight:680;line-height:1.1;
letter-spacing:-0.02em;font-variant-numeric:tabular-nums;
color:var(--vibeui-alert-009-accent);
}
[data-vibeui-block="alert-009"] [data-part="text"]{display:flex;flex-direction:column;gap:0.125rem;flex:1 1 auto;min-width:0}
[data-vibeui-block="alert-009"] [data-part="title"]{font-size:0.875rem;font-weight:600;line-height:1.35}
[data-vibeui-block="alert-009"] [data-part="description"]{font-size:0.8125rem;line-height:1.5;color:var(--vibeui-alert-009-muted)}
[data-vibeui-block="alert-009"] [data-part="track"]{
margin-top:0.4375rem;height:0.1875rem;border-radius:9999px;
background:var(--vibeui-alert-009-track);overflow:hidden;
}
/* Полоса показывает остаток, а не пройденное: она сжимается к нулю. */
[data-vibeui-block="alert-009"] [data-part="bar"]{
display:block;height:100%;border-radius:inherit;
background:var(--vibeui-alert-009-accent);
width:calc((100 - var(--vibeui-alert-009-elapsed,0)) * 1%);
transition:width .3s cubic-bezier(.32,.72,0,1);
}
[data-vibeui-block="alert-009"] [data-part="action"]{
flex:none;display:inline-flex;align-items:center;height:2rem;padding:0 0.875rem;
border-radius:0.5rem;text-decoration:none;
background:var(--vibeui-alert-009-accent);color:oklch(0.2 0.02 70);
font-size:0.8125rem;font-weight:650;
transition:filter .16s ease;
}
[data-vibeui-block="alert-009"] [data-part="action"]:hover{filter:brightness(0.95)}
[data-vibeui-block="alert-009"] [data-part="action"]:focus-visible{outline:2px solid var(--vibeui-alert-009-accent);outline-offset:2px}
@container (max-width: 30rem){
[data-vibeui-block="alert-009"] [data-part="text"]{flex:1 1 100%;order:3}
[data-vibeui-block="alert-009"] [data-part="action"]{margin-left:auto}
}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="alert-009"] *{animation:none!important;transition:none!important}}
`

/**
 * Алерт истекающего срока: остаток крупно, действие рядом, полоса убывает.
 * Один файл, ноль зависимостей, собственная палитра.
 */
export function Alert009({
  title = "Пробный период заканчивается",
  description = "После 14 марта проект останется опубликованным, но редактирование выключится.",
  remaining = "3 дня",
  elapsed = 78,
  actionLabel = "Продлить",
  actionHref = "#",
  accent,
  className,
  style,
  ...props
}: Alert009Props) {
  const clamped = Math.min(100, Math.max(0, elapsed))
  const palette = {
    "--vibeui-alert-009-elapsed": clamped,
    ...(accent ? { "--vibeui-alert-009-accent": accent } : null),
    ...style,
  } as CSSProperties

  return (
    <>
      <style href="vibeui-alert-009" precedence="medium">
        {STYLES}
      </style>
      <div
        {...props}
        data-vibeui-block="alert-009"
        role="status"
        className={className}
        style={palette}
      >
        {remaining ? <span data-part="remaining">{remaining}</span> : null}
        <span data-part="text">
          <span data-part="title">{title}</span>
          {description ? (
            <span data-part="description">{description}</span>
          ) : null}
          <span data-part="track" aria-hidden="true">
            <span data-part="bar" />
          </span>
        </span>
        {actionLabel ? (
          <a data-part="action" href={actionHref}>
            {actionLabel}
          </a>
        ) : null}
      </div>
    </>
  )
}