BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/inferencesh/widgets

Widget Renderer

inferencesh/widgets
FreeBlock

Renders declarative UI nodes (forms, buttons, cards) from agent tool outputs.

Live preview

live · rendered by the registry
Rendered by inferencesh on their own page — this is the component running, not a screenshot of it.

Install it

npx shadcn@latest add https://ui.inference.sh/r/widgets.json

Source

registry/blocks/widgets/widget-renderer.tsxui.inference.sh/r/widgets.json · first 6 KB
1"use client"
2
3import { Markdown } from "@/lib/pretext-md/react"
4import { Badge } from "@/components/ui/badge"
5import { Button } from "@/components/ui/button"
6import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
7import { Checkbox } from "@/components/ui/checkbox"
8import { Input } from "@/components/ui/input"
9import { Label } from "@/components/ui/label"
10import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"
11import type { Widget, WidgetAction, WidgetFormData, WidgetNode } from "@/components/infsh/agent/widget-types"
12import { cn } from "@/lib/utils"
13import React, { createContext, useContext, useState } from "react"
14
15// Use the shared form data type
16type FormData = WidgetFormData
17
18// Local variant types (shadcn doesn't export the Props types)
19type ButtonVariant = "default" | "secondary" | "outline" | "ghost" | "destructive" | "link"
20type BadgeVariant = "default" | "secondary" | "outline" | "destructive"
21
22const toButtonVariant = (v?: string): ButtonVariant => {
23 if (v === "default" || v === "secondary" || v === "outline" || v === "ghost" || v === "destructive" || v === "link") {
24 return v
25 }
26 return "default"
27}
28
29const toBadgeVariant = (v?: string): BadgeVariant => {
30 if (v === "default" || v === "secondary" || v === "outline" || v === "destructive") {
31 return v
32 }
33 return "default"
34}
35
36// Context for handling widget actions
37type WidgetContextValue = {
38 onAction: (action: WidgetAction, formData?: FormData) => void
39 formData: FormData
40 setFormValue: (name: string, value: string | boolean) => void
41 isDisabled: boolean
42 loadingActionType: string | null
43}
44
45const WidgetContext = createContext<WidgetContextValue | null>(null)
46
47const useWidgetContext = () => {
48 const ctx = useContext(WidgetContext)
49 if (!ctx) throw new Error("useWidgetContext must be used within WidgetRenderer")
50 return ctx
51}
52
53// Helper to map text variant to CSS classes
54const toTextClasses = (variant?: string): string => {
55 switch (variant) {
56 case "muted":
57 return "text-xs text-muted-foreground"
58 case "bold":
59 return "text-sm font-medium"
60 case "title":
61 return "text-sm font-medium"
62 case "small":
63 return "text-xs"
64 default:
65 return "text-sm"
66 }
67}
68
69// Helper to map size to font size classes
70const toSizeClasses = (size?: string): string => {
71 switch (size) {
72 case "xs": return "text-xs"
73 case "sm": return "text-sm"
74 case "md": return "text-base"
75// … truncated

What it pulls in

Other registry items

  • badge
  • button
  • card
  • checkbox
  • input
  • label
  • select
  • textarea
  • https://ui.inference.sh/r/pretext-md.json

Files it writes

  • registry/blocks/widgets/widget-renderer.tsx
  • registry/blocks/widgets/types.ts

Facts

Registry
inferencesh
Type
registry:block
Access
Free
Files written
2
Licence
the repository states none
First indexed
2026-08-02
Last confirmed
yesterday

Go to the source

Docs on inferencesh ui.inference.sh Raw registry item This item as JSON

More from inferencesh

All 14 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Agent ChatagentinferenceshBlocksFree1 dep
Chat UI PrimitiveschatinferenceshBlocksFree1 dep · 15 files
Code Blockcode-blockinferenceshBlocksFreeno deps · 7 files
Markdown Renderer (legacy)markdowninferenceshBlocksFree2 deps · 2 files
pretext-mdpretext-mdinferenceshBlocksFree4 deps · 10 files
Sidebar Lightsidebar-lightinferenceshBlocksFreeno deps
StepsstepsinferenceshBlocksFreeno deps · 2 files
Table of Contentstable-of-contentsinferenceshBlocksFreeno deps
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex