Context widgets
Code
- Auto-selected: no (set
ui:widgetexplicitly) ui:options:language(Shiki language id, for exampletypescript,json,bash,diff)
context: {
data: { migrationSnippet: "export const timeoutMs = 5000;" },
ui: {
migrationSnippet: {
"ui:widget": "code",
"ui:options": { language: "typescript" },
},
},
}Inbox preview
Rendered by the dashboard (static preview route). Matches docs light/dark mode. Handle actions are disabled; use the toolbar to submit this example to your inbox or view its configuration.
Context
{
"data": {
"migrationSnippet": "export const timeoutMs = 5000;\n\nexport function withTimeout<T>(promise: Promise<T>): Promise<T> {\n return Promise.race([\n promise,\n new Promise<T>((_, reject) =>\n setTimeout(() => reject(new Error(\"Timeout\")), timeoutMs)\n ),\n ]);\n}"
},
"ui": {
"migrationSnippet": {
"ui:title": "Migration snippet",
"ui:widget": "code",
"ui:options": {
"language": "typescript"
}
}
}
}See also
This widget also appears in the full Code Review task example.