Skip to content

feat(text): expand as prop to accept additional HTML text elements#452

Merged
mattrothenberg merged 1 commit intocloudflare:mainfrom
mattrothenberg:feat/text-expand-as-elements
Apr 27, 2026
Merged

feat(text): expand as prop to accept additional HTML text elements#452
mattrothenberg merged 1 commit intocloudflare:mainfrom
mattrothenberg:feat/text-expand-as-elements

Conversation

@mattrothenberg
Copy link
Copy Markdown
Collaborator

Summary

  • Expands TextElement union to accept 13 additional HTML text-appropriate elements: label, dt, dd, li, figcaption, legend, pre, code, em, strong, small, abbr, and time.
  • Unblocks downstream Stratus usage where Text is rendered as definition list terms (dt/dd), form labels, pre/code blocks, etc.
  • Fixes a pre-existing ref type bug: the internal forwardRef used HTMLHeadingElement even though the component could render span or p. Widened to HTMLElement which is the correct common base for all text elements.

New elements by category

Category Elements
Block text pre
Inline text code, em, strong, small, abbr, time
Form-related label, legend
List/definition dt, dd, li
Figure figcaption

No runtime behavior changes — if (as) return as already handled any value in the union.

  • Reviews
  • bonk has reviewed the change
  • automated review not possible because: type-level expansion, needs human review
  • Tests
  • Tests included/updated

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
@mattrothenberg
Copy link
Copy Markdown
Collaborator Author

/bonk

@mattrothenberg mattrothenberg self-assigned this Apr 27, 2026
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 27, 2026

npm i https://pkg.pr.new/@cloudflare/kumo@452

commit: c96c4b7

@github-actions
Copy link
Copy Markdown
Contributor

Docs Preview

View docs preview

Commit: c96c4b7

@github-actions
Copy link
Copy Markdown
Contributor

Visual Regression Report — 0 changed, 2 unchanged

No visual changes detected.

@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk Bot commented Apr 27, 2026

@mattrothenberg Bonk workflow was cancelled.

View workflow run · To retry, trigger Bonk again.

@mattrothenberg
Copy link
Copy Markdown
Collaborator Author

/bonk

@mattrothenberg
Copy link
Copy Markdown
Collaborator Author

/bigbonk

@mattrothenberg
Copy link
Copy Markdown
Collaborator Author

/bonk

@mattrothenberg mattrothenberg requested a review from Brayden April 27, 2026 15:29
@mattrothenberg mattrothenberg merged commit c1c60c8 into cloudflare:main Apr 27, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants