The Open Standard for Generative UI
Add Handsontable + OpenUI Chat example (#455)
Visharad Kashyapdb374b39e640
diff --git a/examples/hands-on-table-chat/README.md b/examples/hands-on-table-chat/README.mdindex e95cbb39e..322ced023 100644--- a/examples/hands-on-table-chat/README.md+++ b/examples/hands-on-table-chat/README.md@@ -132,7 +132,7 @@ hands-on-table-chat/| [`@openuidev/react-headless`](https://openui.com/docs) | OpenUI adapter and message formatting || [`@openuidev/react-lang`](https://openui.com/docs) | OpenUI Lang component library DSL || [`openai`](https://www.npmjs.com/package/openai) | OpenAI SDK for chat completions with tool calling |-| [`next`](https://nextjs.org/) | React framework with API routes and SSE streaming |+| [`next`](https://nextjs.org/) | React framework with API routes and SSE streaming. |## Try These Promptsdiff --git a/examples/hands-on-table-chat/package.json b/examples/hands-on-table-chat/package.jsonindex 130786705..b3c62f052 100644--- a/examples/hands-on-table-chat/package.json+++ b/examples/hands-on-table-chat/package.json@@ -21,6 +21,7 @@"openai": "^6.34.0","react": "19.2.4","react-dom": "19.2.4",+ "recharts": "^2.15.4","zod": "^4.3.6"},"devDependencies": {diff --git a/examples/hands-on-table-chat/src/generated/system-prompt.txt b/examples/hands-on-table-chat/src/generated/system-prompt.txtindex d7bffe358..01bfea3ee 100644--- a/examples/hands-on-table-chat/src/generated/system-prompt.txt+++ b/examples/hands-on-table-chat/src/generated/system-prompt.txt@@ -163,22 +163,17 @@ info = TextContent("Your spreadsheet has 5 products with quarterly sales data. Tfollowups = Buttons([Button("Visualize sales trends", null, "secondary"), Button("Add a new product", null, "secondary"), Button("Show top performers", null, "secondary")])root = Stack([title, chart, followups])-title = TextContent("Q1-Q4 Sales Comparison", "large-heavy")-chart = BarChart("Quarterly Sales", [q1, q2, q3, q4], "Quarter", "Sales ($)")-q1 = BarChartData("Q1", [w1a, w1b])-w1a = BarChartBar("Widget A", 1500)-w1b = BarChartBar("Widget B", 1200)-q2 = BarChartData("Q2", [w2a, w2b])-w2a = BarChartBar("Widget A", 1800)-w2b = BarChartBar("Widget B", 1400)-q3 = BarChartData("Q3", [w3a, w3b])-w3a = BarChartBar("Widget A", 2100)-w3b = BarChartBar("Widget B", 1600)-q4 = BarChartData("Q4", [w4a, w4b])-w4a = BarChartBar("Widget A", 2400)-w4b = BarChartBar("Widget B", 1900)+title = TextContent("Q1-Q4 Revenue Comparison", "large-heavy")+chart = BarChart(["Q1", "Q2", "Q3", "Q4"], [s1, s2], "grouped", "Quarter", "Revenue ($)")+s1 = Series("Widget A", [1500, 1800, 2100, 2400])+s2 = Series("Widget B", [1200, 1400, 1600, 1900])followups = Buttons([Button("Show as a table", null, "secondary"), Button("Compare Q1 vs Q4", null, "secondary")])+root = Stack([title, pie, followups])+title = TextContent("Revenue by Category", "large-heavy")+pie = PieChart(["Laptops", "Phones", "Audio", "Tablets"], [236800, 521700, 149200, 104100], "donut")+followups = Buttons([Button("Show as a bar chart", null, "secondary"), Button("Break down by quarter", null, "secondary")])+root = Stack([msg, sheet, followups])msg = TextContent("Done! I added Widget C with Q1=500, Q2=600, Q3=700, Q4=800 and a SUM formula for Total.")sheet = SpreadsheetTable([["Widget A", 1500, 1800, 2100, 2400, "=SUM(B1:E1)"], ["Widget B", 1200, 1400, 1600, 1900, "=SUM(B2:E2)"], ["Widget C", 500, 600, 700, 800, "=SUM(B3:E3)"]], ["Product", "Q1 Sales", "Q2 Sales", "Q3 Sales", "Q4 Sales", "Total"])diff --git a/examples/hands-on-table-chat/src/lib/spreadsheet-library.tsx b/examples/hands-on-table-chat/src/lib/spreadsheet-library.tsxindex a0b1c9cb5..fbd7b47be 100644--- a/examples/hands-on-table-chat/src/lib/spreadsheet-library.tsx+++ b/examples/hands-on-table-chat/src/lib/spreadsheet-library.tsx@@ -47,7 +47,8 @@ export const promptOptions: PromptOptions = {],examples: [`root = Stack([title, info, followups])\ntitle = TextContent("Sales Summary", "large-heavy")\ninfo = TextContent("Your spreadsheet has 5 products with quarterly sales data. Total revenue across all products is $45,350.")\nfollowups = Buttons([Button("Visualize sales trends", null, "secondary"), Button("Add a new product", null, "secondary"), Button("Show top performers", null, "secondary")])`,- `root = Stack([title, chart, followups])\ntitle = TextContent("Q1-Q4 Sales Comparison", "large-heavy")\nchart = BarChart("Quarterly Sales", [q1, q2, q3, q4], "Quarter", "Sales ($)")\nq1 = BarChartData("Q1", [w1a, w1b])\nw1a = BarChartBar("Widget A", 1500)\nw1b = BarChartBar("Widget B", 1200)\nq2 = BarChartData("Q2", [w2a, w2b])\nw2a = BarChartBar("Widget A", 1800)\nw2b = BarChartBar("Widget B", 1400)\nq3 = BarChartData("Q3", [w3a, w3b])\nw3a = BarChartBar("Widget A", 2100)\nw3b = BarChartBar("Widget B", 1600)\nq4 = BarChartData("Q4", [w4a, w4b])\nw4a = BarChartBar("Widget A", 2400)\nw4b = BarChartBar("Widget B", 1900)\nfollowups = Buttons([Button("Show as a table", null, "secondary"), Button("Compare Q1 vs Q4", null, "secondary")])`,+ `root = Stack([title, chart, followups])\ntitle = TextContent("Q1-Q4 Revenue Comparison", "large-heavy")\nchart = BarChart(["Q1", "Q2", "Q3", "Q4"], [s1, s2], "grouped", "Quarter", "Revenue ($)")\ns1 = Series("Widget A", [1500, 1800, 2100, 2400])\ns2 = Series("Widget B", [1200, 1400, 1600, 1900])\nfollowups = Buttons([Button("Show as a table", null, "secondary"), Button("Compare Q1 vs Q4", null, "secondary")])`,+ `root = Stack([title, pie, followups])\ntitle = TextContent("Revenue by Category", "large-heavy")\npie = PieChart(["Laptops", "Phones", "Audio", "Tablets"], [236800, 521700, 149200, 104100], "donut")\nfollowups = Buttons([Button("Show as a bar chart", null, "secondary"), Button("Break down by quarter", null, "secondary")])`,`root = Stack([msg, sheet, followups])\nmsg = TextContent("Done! I added Widget C with Q1=500, Q2=600, Q3=700, Q4=800 and a SUM formula for Total.")\nsheet = SpreadsheetTable([["Widget A", 1500, 1800, 2100, 2400, "=SUM(B1:E1)"], ["Widget B", 1200, 1400, 1600, 1900, "=SUM(B2:E2)"], ["Widget C", 500, 600, 700, 800, "=SUM(B3:E3)"]], ["Product", "Q1 Sales", "Q2 Sales", "Q3 Sales", "Q4 Sales", "Total"])\nfollowups = Buttons([Button("Add another product", null, "secondary"), Button("Show updated totals", null, "secondary"), Button("Visualize the data", null, "secondary")])`,],};diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 4a4417f6e..e7dd11ded 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -244,6 +244,9 @@ importers:react-dom:specifier: 19.2.4version: 19.2.4([email protected])+ recharts:+ specifier: ^2.15.4zod:specifier: ^4.3.6version: 4.3.6