Charts
Funnel
A funnel with step-to-step rates: what matters is not the bar widths but how many people are lost between steps.
- chart
- funnel
- conversion
- analytics
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/chart-008?lang=en
Открыли каталог4820 · 100%
ушли 56% от предыдущего шага
Открыли компонент2140 · 44%
ушли 60% от предыдущего шага
Скопировали команду860 · 18%
ушли 52% от предыдущего шага
Поставили компонент412 · 9%
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 "chart-008" (Funnel) 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/chart-008.json
Registry item: https://vibeui.ru/r/chart-008.json
Installs to: components/vibeui/chart-008.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 funnel with step-to-step rates: what matters is not the bar widths but how many people are lost between steps.
A step funnel: a bar per step, its share of the first step, the absolute number and the drop-off between steps. Zero dependencies, one file, no client JS.
## 3. How to use it
import { Chart008 } from "@/components/vibeui/chart-008"
<Chart008 steps={[{ label: "Opened", value: 4820 }]} unit="people" />
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-chart-008-* palette — do not swap it for your theme tokens
- the step-to-step rate: that is what shows where people are lost
- absolute numbers beside the shares — a 40% drop from twenty people means nothing
- measuring shares against the first step, not the previous one: otherwise the funnel lies about scale
- role="img" with the number on every bar
- the minimum bar width: a near-zero step must not vanish
## 6. You may change
- the steps array
- title and unit
- the accent through the accent prop
- the bar height
## 7. Rules
- Steps must descend: a funnel that grows in the middle means broken data, not growth.
- The component computes no period conversion: it shows one snapshot.
- Beyond six steps a funnel stops reading: merge adjacent stages.
- 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/chart-008.jsonhttps://vibeui.ru/r/chart-008.jsonКомпонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-chart-008-*. Серверный: хуков нет. Ширина шага — доля от первого, насыщенность заливки считается через color-mix от той же доли. Между шагами печатается процент потерь относительно предыдущего. У каждой полосы есть role="img" с абсолютным значением.
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 Chart008Step = {
label: string
value: number
}
export type Chart008Props = Omit<
ComponentPropsWithoutRef<"figure">,
"children" | "title"
> & {
title?: string
steps?: Chart008Step[]
unit?: string
accent?: string
}
// Идея компонента: воронка с переходами между шагами. Главное в ней — не
// ширина полос, а процент перехода от предыдущего шага: именно он показывает,
// где теряются люди. Абсолютные числа остаются рядом, потому что «падение на
// 40%» с базы в двадцать человек ничего не значит.
const STYLES = `
:where([data-vibeui-block="chart-008"]){
--vibeui-chart-008-bg:oklch(1 0 0);
--vibeui-chart-008-fg:oklch(0.22 0.014 265);
--vibeui-chart-008-muted:oklch(0.56 0.014 265);
--vibeui-chart-008-border:oklch(0.91 0.006 265);
--vibeui-chart-008-accent:oklch(0.55 0.17 265);
--vibeui-chart-008-drop:oklch(0.58 0.16 25);
--vibeui-chart-008-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
[data-vibeui-block="chart-008"]{
display:flex;flex-direction:column;gap:0.5rem;
width:100%;max-width:22rem;box-sizing:border-box;margin:0;padding:0.875rem;
background:var(--vibeui-chart-008-bg);
border:1px solid var(--vibeui-chart-008-border);border-radius:0.875rem;
color:var(--vibeui-chart-008-fg);font-family:var(--vibeui-chart-008-font);
}
[data-vibeui-block="chart-008"] [data-part="title"]{margin:0;font-size:0.875rem;font-weight:650}
[data-vibeui-block="chart-008"] ol{display:flex;flex-direction:column;gap:0.375rem;margin:0;padding:0;list-style:none}
[data-vibeui-block="chart-008"] [data-part="row"]{display:flex;flex-direction:column;gap:0.25rem}
[data-vibeui-block="chart-008"] [data-part="head"]{
display:flex;align-items:baseline;justify-content:space-between;gap:0.5rem;font-size:0.8125rem;
}
[data-vibeui-block="chart-008"] [data-part="value"]{font-weight:650;font-variant-numeric:tabular-nums}
[data-vibeui-block="chart-008"] [data-part="bar"]{
height:1.25rem;border-radius:0.375rem;
background:color-mix(in oklab,var(--vibeui-chart-008-accent) var(--vibeui-chart-008-mix,80%),oklch(0.94 0.005 265));
}
/* Переход между шагами: именно он показывает, где теряются люди. */
[data-vibeui-block="chart-008"] [data-part="drop"]{
display:flex;align-items:center;gap:0.375rem;padding-left:0.25rem;
font-size:0.75rem;color:var(--vibeui-chart-008-muted);
}
[data-vibeui-block="chart-008"] [data-part="drop"] b{color:var(--vibeui-chart-008-drop);font-weight:650;font-variant-numeric:tabular-nums}
[data-vibeui-block="chart-008"] [data-part="drop"]::before{
content:"";width:0.375rem;height:0.375rem;
border-left:1.5px solid var(--vibeui-chart-008-muted);
border-bottom:1.5px solid var(--vibeui-chart-008-muted);
transform:rotate(-45deg) translateY(-0.0625rem);
}
[data-vibeui-block="chart-008"] [data-part="unit"]{font-size:0.75rem;color:var(--vibeui-chart-008-muted)}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="chart-008"] *{animation:none!important;transition:none!important}}
`
const DEFAULT_STEPS: Chart008Step[] = [
{ label: "Открыли каталог", value: 4820 },
{ label: "Открыли компонент", value: 2140 },
{ label: "Скопировали команду", value: 860 },
{ label: "Поставили компонент", value: 412 },
]
/**
* Воронка с процентами перехода между шагами.
* Один файл, ноль зависимостей, собственная палитра.
*/
export function Chart008({
title = "Путь до установки",
steps = DEFAULT_STEPS,
unit = "человек за неделю",
accent,
className,
style,
...props
}: Chart008Props) {
const first = steps[0]?.value || 1
const palette = {
...(accent ? { "--vibeui-chart-008-accent": accent } : null),
...style,
} as CSSProperties
return (
<>
<style href="vibeui-chart-008" precedence="medium">
{STYLES}
</style>
<figure
{...props}
data-vibeui-block="chart-008"
className={className}
style={palette}
>
<figcaption data-part="title">{title}</figcaption>
<ol>
{steps.map((step, index) => {
const previous = steps[index - 1]
const share = Math.round((step.value / first) * 100)
const drop = previous
? Math.round((1 - step.value / previous.value) * 100)
: 0
return (
<li key={step.label}>
{previous ? (
<p data-part="drop">
ушли <b>{drop}%</b> от предыдущего шага
</p>
) : null}
<div data-part="row">
<p data-part="head">
<span>{step.label}</span>
<span data-part="value">
{step.value} · {share}%
</span>
</p>
<div
data-part="bar"
role="img"
aria-label={`${step.label}: ${step.value} ${unit}, ${share}% от первого шага`}
style={
{
width: `${Math.max(12, share)}%`,
"--vibeui-chart-008-mix": `${Math.max(35, share)}%`,
} as CSSProperties
}
/>
</div>
</li>
)
})}
</ol>
<figcaption data-part="unit">{unit}</figcaption>
</figure>
</>
)
}