Priority Budget
Распределение общего ограниченного бюджета очков. Бесплатно, MIT · Интерактивные блоки › Холсты, выделение и бюджет
Установка
npx valyro-cli@latest add priority-budget
npx shadcn@latest add https://valyro.xyz/r/priority-budget.json
npm install valyro-ui
import 'valyro-ui/styles.css';
import { PriorityBudget } from 'valyro-ui';
Пропсы
| Prop | Type | Default | |
|---|---|---|---|
items * | BudgetItem[] | The items sharing the budget, in display (and redistribution) order. | |
total * | number | The shared resource: points, hours, percent. | |
step | number | 1 | Smallest change, shared by every item; values, limits and the total are its multiples. Default 1. |
mode | 'pool' | 'redistribute' | 'pool' | pool (default): a change spends or returns the free remainder, the other items stay. redistribute: the sum is always total, the other unlocked items pay for a change evenly, leftover steps in item order. |
value | Record<string, number> | Values by item id. The accepted values are shown; a change is only requested through onValueChange. | |
defaultValue | Record<string, number> | Starting profile when uncontrolled; also what Reset returns to. | |
onValueChange | (value: Record<string, number>, detail: BudgetChangeDetail) => void | Called with the new value when it changes. | |
lockedIds | string[] | Ids of locked items: redistribution never moves them, and they cannot be changed. | |
defaultLockedIds | string[] | [] | Initial lockedIds when uncontrolled. |
onLockedIdsChange | (ids: string[]) => void | Called with the new lockedIds when it changes. | |
formatValue | (value: number) => string | Formats a value for display. Default: the number with the step's decimals. | |
disabled | boolean | false | Turns every control off. |
labels | Partial<PriorityBudgetLabels> | Overrides for the built-in English text; keys left out keep their defaults. |
Похожие компоненты
- Sticker Board — Свободная композиция из фотографий, наклеек и заметок: двигать и поворачивать
- Lasso Select — Выделение группы карточек рамкой
- Feature Hotspots — Точки на изображении: нажатие открывает пояснение к детали
- Exploded Layers — Подготовленные слои изображения раздвигаются с подписями
- Prediction Card — Сначала предположение читателя, затем ответ и разбор
- Detail Dial — Выбор глубины объяснения: кратко, подробно, полный разбор
- Version Scrubber — Просмотр подготовленных версий одним ползунком
- Page Minimap — Мини-карта длинной страницы с видимой областью
- Peel Sticker — Наклейка отклеивается за угол и открывает содержимое
- Scratch Reveal — Стираемое покрытие над текстом или картинкой
- Tear-off Ticket — Билет с корешком, который отрывается по перфорации
- Split-Flap Board — Механическое табло: перелистываются только изменившиеся символы
Назад: Lasso Select · Далее: Gradient Mixer · Весь раздел «Интерактивные блоки»