Skip to content

fix(alert): make headingLevel optional without heading#3496

Draft
YforC wants to merge 1 commit into
trussworks:mainfrom
YforC:fix-alert-heading-level-optional
Draft

fix(alert): make headingLevel optional without heading#3496
YforC wants to merge 1 commit into
trussworks:mainfrom
YforC:fix-alert-heading-level-optional

Conversation

@YforC

@YforC YforC commented Jun 9, 2026

Copy link
Copy Markdown

Summary

Make Alert require headingLevel only when a heading is provided. Headingless alerts already render with the component's default heading level internally, so consumers should not need to pass a heading level for alerts that do not render a heading.

The stories and tests now cover headingless alerts without headingLevel, matching the intended public API.

Related Issues or PRs

Closes #3244

How To Test

  • corepack yarn vitest --run src/components/Alert/Alert.test.tsx
  • corepack yarn tsc --noEmit

Screenshots (optional)

N/A

Author & Maintainer checklist

  • Is this is a breaking change?
    • Yes, and I accounted for the breaking changes according to the linked documentation
    • No
  • Once merged, add the PR and Issue author(s) as a contributor(s) via the all-contributors bot

@brandonlenz

brandonlenz commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

@YforC thanks for this! Just as a heads up, I've got a major (breaking) refactor of the Alert component.

I started with almost the exact changes that you're proposing here (except using never for headingLevel in the event that heading was not defined), but decided (since the TS contract would become breaking anyways) that a refactor to align with the goals of more flexibly composability would be good timing.

Let me know what your thoughts are on #3497

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.

[feat] Make Alert headingLevel prop optional

2 participants