Valyro Русская версия

Crafting Recipe

Recipe card: batches, ingredients needed and what is missing. Free, MIT · Interactive blocks › Small editors and calculators

A recipe card linking the quantity you want to whole batches, the output, the surplus and every ingredient's need against the stock. A known shortage blocks crafting, unknown stock is left to the app's check in onCraft, and the success animation only starts once the app confirms.

Installation

npx valyro-cli@latest add crafting-recipe
npx shadcn@latest add https://valyro.xyz/r/crafting-recipe.json
npm install valyro-ui

import 'valyro-ui/styles.css';
import { CraftingRecipe } from 'valyro-ui';

Props

PropTypeDefault
recipe *RecipeThe recipe: what one batch makes and uses.
inventoryRecord<string, number>Stock per ingredient id; an ingredient without an entry is unknown (not zero).
quantitynumberResults asked for: a positive whole number.
defaultQuantitynumber1Initial quantity when uncontrolled. Default 1.
onQuantityChange(quantity: number) => voidCalled with the new quantity when it changes.
maxQuantitynumberLargest quantity the app allows; more shows an error instead of being clamped.
onCraft(request: CraftRequest) => void | Promise<void>Crafts: returning (or resolving) confirms it, throwing (or rejecting) refuses it. While a promise runs the button and the quantity are locked. Without it the card only computes.
disabledbooleanfalseLocks the quantity and the craft button.
headingLevel2 | 3 | 4 | 5 | 63Level of the result's heading. Default 3.
labelsPartial<CraftingRecipeLabels>Overrides for the built-in English text; keys left out keep their defaults.

Related components

  • Gradient Mixer — Drag colour points over a canvas and copy the layered CSS gradient
  • Pixel Painter — Draw on a pixel grid and save a PNG
  • Feature Hotspots — Numbered points on an image that open a note about each detail
  • Exploded Layers — Prepared image layers pulled apart with captions
  • Prediction Card — The reader guesses first, then sees the answer and the explanation
  • Detail Dial — Choose how deep an explanation goes: short, detailed or full
  • Version Scrubber — Step through prepared versions of a design with one slider
  • Page Minimap — Schematic map of a long page with the visible area
  • Peel Sticker — A sticker you peel back by its corner to reveal what is under it
  • Scratch Reveal — Scratch off a cover to reveal text or a picture
  • Tear-off Ticket — A ticket whose stub tears off along the perforation
  • Split-Flap Board — Mechanical departure board: only the changed characters flip

Previous: Pixel Painter · Next: Scroll Effect · All Interactive blocks