Inputs
Transfer Fee
A transfer amount with its fee and the total debit: a field showing only the typed number lies, because more leaves the account.
- currency
- transfer
- fee
- checkout
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/currency-006?lang=en
Получатель получит12 000 ₽
Комиссия 1.5%180 ₽
Спишется с карты12 180 ₽
Комиссия 1.5%, но не меньше 50 ₽
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 "currency-006" (Transfer Fee) 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/currency-006.json
Registry item: https://vibeui.ru/r/currency-006.json
Installs to: components/vibeui/currency-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
A transfer amount with its fee and the total debit: a field showing only the typed number lies, because more leaves the account.
A transfer field computing the fee and the total debit under a "percent, but no less than a minimum" rule. Zero dependencies, one file.
## 3. How to use it
import { Currency006 } from "@/components/vibeui/currency-006"
<Currency006 label="Transfer amount" percent={1.5} minFee={50} defaultValue={12000} />
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-currency-006-* palette — do not swap it for your theme tokens
- its own light surface: the receipt gets shown over any background
- showing the total before confirmation: learning about a fee on the last screen is a reason to cancel
- the "percent, but no less than a minimum" rule: small transfers are billed by the minimum and that has to be computed
- the split into three lines: what the recipient gets, the fee and the debit are different numbers people confuse
- the larger total: that is the number checked against the card balance
- aria-live on the receipt: the lines recompute on every keystroke
## 6. You may change
- label — the field caption
- percent — the fee rate
- minFee — the minimum fee
- defaultValue — the starting amount
- currency — the currency sign
- the accent through the accent prop
## 7. Rules
- The fee is added on top of the amount: flip the formula if it is taken out of it instead.
- Cents are not rounded to whole units — add rounding if your bank rounds the fee.
- At a zero amount the fee is zeroed on purpose: a minimum fee on an empty field is alarming.
- 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/currency-006.jsonhttps://vibeui.ru/r/currency-006.jsonКомпонент самодостаточен: один файл, ноль зависимостей, палитра в локальных переменных --vibeui-currency-006-*. Клиентский: сумма в состоянии, комиссия и итог вычисляются на лету. Комиссия считается по правилу «процент, но не меньше минимума», как её и берут в жизни: на маленьких переводах работает минимум, на больших — процент. Чек из трёх строк лежит в области aria-live, поэтому изменения озвучиваются; итог набран крупнее остального, потому что именно его сверяют с остатком на карте.
Component source
The same file your agent installs. Here in case you would rather copy it by hand.
"use client"
import { useId, useState } from "react"
import type { ComponentPropsWithoutRef, CSSProperties } from "react"
export type Currency006Props = Omit<
ComponentPropsWithoutRef<"div">,
"children" | "defaultValue" | "onChange"
> & {
label?: string
percent?: number
minFee?: number
defaultValue?: number
currency?: string
accent?: string
}
// Идея компонента: сумма перевода вместе с комиссией и итогом к списанию.
// Поле, которое показывает только введённое число, врёт: со счёта уйдёт больше,
// и это выясняется на экране подтверждения. Здесь чек виден сразу — перевод,
// комиссия, итог, — а комиссия считается по правилу «процент, но не меньше
// минимума», как её и берут в жизни. Итог набран крупнее остального: это то
// число, которое человек сверяет с остатком на карте.
const STYLES = `
:where([data-vibeui-block="currency-006"]){
--vibeui-currency-006-surface:oklch(1 0 0);
--vibeui-currency-006-field:oklch(0.985 0.002 265);
--vibeui-currency-006-shell:oklch(0.9 0.006 265);
--vibeui-currency-006-fg:oklch(0.22 0.014 265);
--vibeui-currency-006-muted:oklch(0.55 0.014 265);
--vibeui-currency-006-border:oklch(0.88 0.008 265);
--vibeui-currency-006-accent:oklch(0.5 0.16 200);
--vibeui-currency-006-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
/* Своя светлая подложка: чек показывают поверх любого фона. */
[data-vibeui-block="currency-006"]{
display:flex;flex-direction:column;gap:0.5rem;
width:100%;max-width:20rem;box-sizing:border-box;padding:0.875rem;
background:var(--vibeui-currency-006-surface);
border:1px solid var(--vibeui-currency-006-shell);border-radius:0.875rem;
font-family:var(--vibeui-currency-006-font);color:var(--vibeui-currency-006-fg);
}
[data-vibeui-block="currency-006"] label{font-size:0.8125rem;font-weight:650}
[data-vibeui-block="currency-006"] [data-part="row"]{
display:flex;align-items:center;gap:0.375rem;
padding:0 0.875rem;box-sizing:border-box;height:3rem;
border:1px solid var(--vibeui-currency-006-border);border-radius:0.75rem;
background:var(--vibeui-currency-006-field);
}
[data-vibeui-block="currency-006"] [data-part="row"]:focus-within{
border-color:var(--vibeui-currency-006-accent);
box-shadow:0 0 0 2px oklch(0.5 0.16 200 / 18%);
}
[data-vibeui-block="currency-006"] input{
flex:1 1 auto;min-width:0;width:100%;
appearance:none;border:0;background:none;outline:none;
height:100%;color:inherit;text-align:right;
font:inherit;font-size:1.375rem;font-weight:700;font-variant-numeric:tabular-nums;
}
[data-vibeui-block="currency-006"] input::-webkit-outer-spin-button,
[data-vibeui-block="currency-006"] input::-webkit-inner-spin-button{appearance:none;margin:0}
[data-vibeui-block="currency-006"] [data-part="sign"]{
flex:none;font-size:1.125rem;font-weight:700;color:var(--vibeui-currency-006-muted);
}
/* Чек: перевод, комиссия, итог — до подтверждения, а не после. */
[data-vibeui-block="currency-006"] [data-part="check"]{
display:flex;flex-direction:column;gap:0.375rem;margin:0;
padding:0.625rem 0.75rem;border-radius:0.625rem;
background:var(--vibeui-currency-006-field);
}
[data-vibeui-block="currency-006"] [data-part="line"]{
display:flex;align-items:baseline;justify-content:space-between;gap:0.75rem;
font-size:0.8125rem;color:var(--vibeui-currency-006-muted);
font-variant-numeric:tabular-nums;
}
[data-vibeui-block="currency-006"] [data-part="line"] span:last-child{color:var(--vibeui-currency-006-fg);font-weight:600}
/* Итог крупнее: это число сверяют с остатком на карте. */
[data-vibeui-block="currency-006"] [data-part="total"]{
display:flex;align-items:baseline;justify-content:space-between;gap:0.75rem;
padding-top:0.375rem;border-top:1px solid var(--vibeui-currency-006-border);
font-size:0.8125rem;font-weight:650;
}
[data-vibeui-block="currency-006"] [data-part="total"] b{
font-size:1.125rem;font-weight:750;color:var(--vibeui-currency-006-accent);
font-variant-numeric:tabular-nums;
}
[data-vibeui-block="currency-006"] [data-part="rule"]{
margin:0;font-size:0.6875rem;color:var(--vibeui-currency-006-muted);
}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="currency-006"] *{animation:none!important;transition:none!important}}
`
function money(value: number) {
return value.toLocaleString("ru-RU", { maximumFractionDigits: 2 })
}
/**
* Сумма перевода с комиссией и итогом к списанию, посчитанными сразу.
* Один файл, ноль зависимостей, собственная палитра.
*/
export function Currency006({
label = "Сумма перевода",
percent = 1.5,
minFee = 50,
defaultValue = 12000,
currency = "₽",
accent,
className,
style,
...props
}: Currency006Props) {
const id = useId()
const [amount, setAmount] = useState(defaultValue)
// Комиссия по правилу «процент, но не меньше минимума» — так её и берут.
const fee = amount > 0 ? Math.max(minFee, (amount * percent) / 100) : 0
const total = amount + fee
const palette = {
...(accent ? { "--vibeui-currency-006-accent": accent } : null),
...style,
} as CSSProperties
return (
<>
<style href="vibeui-currency-006" precedence="medium">
{STYLES}
</style>
<div
{...props}
data-vibeui-block="currency-006"
className={className}
style={palette}
>
<label htmlFor={id}>{label}</label>
<div data-part="row">
<input
id={id}
type="number"
inputMode="numeric"
min={0}
step={100}
value={amount}
aria-describedby={`${id}-check`}
onChange={(event) => {
const next = Number(event.target.value)
setAmount(Number.isFinite(next) ? Math.max(0, next) : 0)
}}
/>
<span data-part="sign" aria-hidden="true">
{currency}
</span>
</div>
<div id={`${id}-check`} data-part="check" aria-live="polite">
<p data-part="line">
<span>Получатель получит</span>
<span>
{money(amount)} {currency}
</span>
</p>
<p data-part="line">
<span>Комиссия {percent}%</span>
<span>
{money(fee)} {currency}
</span>
</p>
<p data-part="total">
<span>Спишется с карты</span>
<b>
{money(total)} {currency}
</b>
</p>
</div>
<p data-part="rule">
Комиссия {percent}%, но не меньше {minFee} {currency}
</p>
</div>
</>
)
}