OpenUI Lang: Allow registered formatting functions
Maintainers usually reply within 1 day
@Aditya-thesys is already working on this.
Since Mar 25, 2026.
Assessment
This issue has not been assessed yet.
Description
Is your feature request related to a problem? Please describe.
OpenUI Lang can render structured UI from model output, but there is not a clear way for host applications to expose safe, reusable functions that generated UI can call when displaying values.
Many apps need formatting or transformation logic that should live in application code, not in model output. Examples include formatCurrency, formatDate, formatPercent, formatFileSize, formatDuration, formatStatus, and getDisplayName.
Without first-class support for registered functions, developers either need to pre-format all values before passing them to OpenUI, create one-off components for simple display logic, or let the model decide raw formatting. That makes generated UI less reusable and can lead to inconsistent formatting across an app.
Describe the solution you'd like
Add support for user-defined, host-registered functions in OpenUI Lang.
The model should be able to reference named functions that the host application explicitly registers, without emitting arbitrary executable code.
Ideally, this should support:
- Registering named functions in the renderer/runtime.
- Calling those functions from OpenUI Lang expressions or component props.
- Passing arguments from state, query results, literals, or other expressions.
- Synchronous formatting functions for common display transforms.
- Type/schema metadata so prompts can describe available functions to the model.
- Clear error handling when a function is missing or receives invalid arguments.
- React support first, with the core behavior living in @openuidev/lang-core where possible.
- Documentation and examples for common formatters such as currency, dates, and percentages.
Describe alternatives you've considered
- Pre-format values before passing data into OpenUI.
- Add more built-in formatting helpers to OpenUI Lang.
- Create custom components for each formatting need.
- Allow arbitrary JavaScript expressions in generated output.
These alternatives either duplicate logic, do not cover app-specific formatting needs, or introduce safety concerns.
Additional context
The key constraint is safety. The model should only be able to call functions that the host application has registered and described. It should not be able to emit arbitrary JavaScript or access runtime globals.
This would make OpenUI Lang more useful for dashboards, reports, financial UI, analytics views, and any generated UI that needs consistent app-specific display formatting.
- Dominant language
- TypeScript
- Stars
- 10k
- Forks
- 698
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 133
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from thesysdev/openui
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
thesysdev/openui#1445 · 2 comments ·
Maintainers usually reply within 1 day
-
Add dataInvention flag to PromptOptions to disable the 'generate realistic/plausible data' ruleOpen
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
thesysdev/openui#959 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 18/100
thesysdev/openui#1528 · 1 reaction ·
Maintainers usually reply within 1 day
All issues in thesysdev/openui
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
formbricks/formbricks#9918 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
thecodacus/pithagoras#364 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
openclimatefix/quartz-frontend#823 ·
Maintainers usually reply within 4 days
-
area:agent-manager community needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
`contacts.create` posts to `/audiences/undefined/contacts` when `audienceId` is undefinedPossibly taken @RaphaelFakhri claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
resend/resend-node#1176 ·
Maintainers usually reply within 1 day