feat(text): expand as prop to accept additional HTML text elements#452
Merged
mattrothenberg merged 1 commit intocloudflare:mainfrom Apr 27, 2026
Merged
Conversation
Add label, dt, dd, li, figcaption, legend, pre, code, em, strong, small, abbr, and time to the TextElement union. This unblocks downstream Stratus usage where Text needs to render as definition list terms, form labels, and code elements. - Widen internal ref from HTMLHeadingElement to HTMLElement (was already incorrect for span/p; now correct for all element types) - Add runtime tests for dt, dd, label, code, pre - Add type-spec positive cases for all 13 new elements - Update JSDoc to document the full set of accepted elements
Collaborator
Author
|
/bonk |
commit: |
Contributor
Docs PreviewCommit: |
Contributor
Visual Regression Report — 0 changed, 2 unchangedNo visual changes detected. |
Contributor
|
@mattrothenberg Bonk workflow was cancelled. View workflow run · To retry, trigger Bonk again. |
Collaborator
Author
|
/bonk |
Collaborator
Author
|
/bigbonk |
Collaborator
Author
|
/bonk |
Brayden
approved these changes
Apr 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TextElementunion to accept 13 additional HTML text-appropriate elements:label,dt,dd,li,figcaption,legend,pre,code,em,strong,small,abbr, andtime.Textis rendered as definition list terms (dt/dd), form labels,pre/codeblocks, etc.forwardRefusedHTMLHeadingElementeven though the component could renderspanorp. Widened toHTMLElementwhich is the correct common base for all text elements.New elements by category
precode,em,strong,small,abbr,timelabel,legenddt,dd,lifigcaptionNo runtime behavior changes —
if (as) return asalready handled any value in the union.