New: Custom Directives in json-render Define your own JSON directives that resolve at render time. → Pick a name ($mask, $theme, $whatever) → Add a Zod schema → Write a resolve function That's it. AI sees them in the catalog. Every renderer resolves them automatically. https://t.co/zNvT7S8EYh
Vercel Adds Custom Directives to json-render for Dynamic Generative UI Logic
Vercel· Updated
Vercel released a new API for its json-render framework that allows developers to define custom logic directives that resolve at render time. This shift enables AI models to generate interfaces with built-in dynamic behaviors like data formatting and mathematical calculations without writing raw code.
defineDirective API that lets developers register $-prefixed dynamic values—such as $mask or $theme—with specific Zod schemas (data validation tools) and resolver functions.This extensibility moves Generative UI beyond static component placement into functional logic. By defining these directives in a catalog, developers give AI models a logic vocabulary for tasks like internationalization or string manipulation. This mirrors json-render/next app generation and follows the launch of json-render devtools.
You can now use the @json-render/directives package to access seven pre-built standard directives, including $math, $format, and $pluralize. The system automatically generates directive signatures in the AI's system prompt, ensuring models understand required fields. The update is available now as part of the json-render v0.19.0 release.
Still wondering? A few quick answers below.
Every HeadsUpAI update is written based on its original source and reviewed before it's published. Read our editorial standards →
