Skip to content

Conversation

@ToMESSKa
Copy link
Contributor

@ToMESSKa ToMESSKa commented Jan 15, 2026

INSTUI-4869

ISSUE:

Heading needs to be migrated to the new theming system

TEST PLAN:

<div>
  <Heading variant="titlePageDesktop" level="h1" renderIcon={<IconAdminSolid/>}>titlePageDesktop</Heading><br/>
  <Heading variant="titlePageMobile" level="h1" renderIcon={<IconAdminSolid/>}>titlePageMobile</Heading><br/>
  <Heading variant="titleSection" level="h2" renderIcon={<IconAdminSolid/>}>titleSection</Heading><br/>
  <Heading variant="titleCardSection" level="h2" renderIcon={<IconAdminSolid/>}>titleCardSection</Heading><br/>
  <Heading variant="titleModule" level="h2" renderIcon={<IconAdminSolid/>}>titleModule</Heading><br/>
  <Heading variant="titleCardLarge" level="h3" renderIcon={<IconAdminSolid/>}>titleCardLarge</Heading><br/>
  <Heading variant="titleCardRegular" level="h3" renderIcon={<IconAdminSolid/>}>titleCardRegular</Heading><br/>
  <Heading variant="titleCardMini" level="h4" renderIcon={<IconAdminSolid/>}>titleCardMini</Heading><br/>
  <Heading variant="label" level="h5" renderIcon={<IconAdminSolid/>}>label</Heading><br/>
  <Heading variant="labelInline" level="h6" renderIcon={<IconAdminSolid/>}>labelInline</Heading><br/>
</div>
<div>
  <Heading level="h1" renderIcon={<IconAdminSolid/>}>titlePageDesktop</Heading><br/>
  <Heading level="h2" renderIcon={<IconAdminSolid/>}>titlePageMobile</Heading><br/>
  <Heading level="h3" renderIcon={<IconAdminSolid/>}>titleSection</Heading><br/>
  <Heading level="h4" renderIcon={<IconAdminSolid/>}>titleCardSection</Heading><br/>
  <Heading level="h5" renderIcon={<IconAdminSolid/>}>titleModule</Heading><br/>
  <Heading level="h6" renderIcon={<IconAdminSolid/>}>titleCardLarge</Heading><br/>
</div>
<div>
  <Heading as="h1" renderIcon={<IconAdminSolid/>}>titlePageDesktop</Heading><br/>
  <Heading as="h2" renderIcon={<IconAdminSolid/>}>titlePageMobile</Heading><br/>
  <Heading as="h3" renderIcon={<IconAdminSolid/>}>titleSection</Heading><br/>
  <Heading as="h4" renderIcon={<IconAdminSolid/>}>titleCardSection</Heading><br/>
  <Heading as="h5" renderIcon={<IconAdminSolid/>}>titleModule</Heading><br/>
  <Heading as="h6" renderIcon={<IconAdminSolid/>}>titleCardLarge</Heading><br/>
</div>
<div>
  <Heading variant="titlePageDesktop" renderIcon={<IconAdminSolid/>}>titlePageDesktop</Heading><br/>
  <Heading variant="titlePageMobile" renderIcon={<IconAdminSolid/>}>titlePageMobile</Heading><br/>
  <Heading variant="titleSection" renderIcon={<IconAdminSolid/>}>titleSection</Heading><br/>
  <Heading variant="titleCardSection" renderIcon={<IconAdminSolid/>}>titleCardSection</Heading><br/>
  <Heading variant="titleModule" renderIcon={<IconAdminSolid/>}>titleModule</Heading><br/>
  <Heading variant="titleCardLarge" renderIcon={<IconAdminSolid/>}>titleCardLarge</Heading><br/>
  <Heading variant="titleCardRegular" renderIcon={<IconAdminSolid/>}>titleCardRegular</Heading><br/>
  <Heading variant="titleCardMini" renderIcon={<IconAdminSolid/>}>titleCardMini</Heading><br/>
  <Heading variant="label" renderIcon={<IconAdminSolid/>}>label</Heading><br/>
  <Heading variant="labelInline" renderIcon={<IconAdminSolid/>}>labelInline</Heading><br/>
</div>
  • check the AI variants
  • check if everything looks visible in dark mode

@github-actions
Copy link

github-actions bot commented Jan 15, 2026

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://instructure.design/pr-preview/pr-2365/

Built to branch gh-pages at 2026-01-23 09:12 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@ToMESSKa ToMESSKa self-assigned this Jan 15, 2026
fontWeight: componentTheme.weightImportant,
fontSize: componentTheme.titlePageDesktop,
lineHeight: componentTheme.lineHeight125
...componentTheme.titlePageDesktop
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a composit token now

Comment on lines 141 to 166
if (aiVariant === 'stacked') {
return (
<>
<span css={this.props.styles?.igniteAIStacked}>
<IconAiColoredSolid />
<span css={this.props.styles?.igniteAI}>IgniteAI</span>
</span>
{children}
</>
)
}
if (aiVariant === 'horizontal') {
return (
<>
<IconAiColoredSolid />
<span css={this.props.styles?.igniteAI}>IgniteAI</span>
<StarsInstUIIcon color="ai" size="sm" />
{children}
</>
)
}
if (aiVariant === 'iconOnly') {
return (
<>
<IconAiColoredSolid />
&nbsp;{children}
</>
Copy link
Contributor Author

@ToMESSKa ToMESSKa Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is some dead code/duplication as the 'stacked', 'horizontal' and 'iconOnly' AI cases are already checked above...(?)

@ToMESSKa ToMESSKa changed the title feat(ui-heading): rework Heading [v12] feat(ui-heading): rework Heading Jan 15, 2026
return (
<span css={[this.props.styles?.withIcon]} aria-hidden="true">
{callRenderProp(renderIcon)}&nbsp;{children}
{renderIconWithProps(renderIcon, iconSize, 'inherit')}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there was a "none breaking space" here before the heading text that is missing

before:
Image

after:
Image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I set a gap for that, can you please check it? (As with no variant or level specified, the component defaults to a h2 and that usually has a gapIconLg)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just realized that the icon size doesn’t change based on the heading level, so H1 and H6 headings both use the same 20px icon. We should fix that and adjust the gap as well. I'll send you the mapping soon

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*I was wrong it works with the Level prop but when I set the "as" prop it changes the font-size but it doesn't change the icon size. I write you on Slack about this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adamlobler Okay, I fixed the as prop, can you check these please:

<div>
  <Heading as="h1" renderIcon={<IconAdminSolid/>}>titlePageDesktop</Heading><br/>
  <Heading as="h2" renderIcon={<IconAdminSolid/>}>titlePageMobile</Heading><br/>
  <Heading as="h3" renderIcon={<IconAdminSolid/>}>titleSection</Heading><br/>
  <Heading as="h4" renderIcon={<IconAdminSolid/>}>titleCardSection</Heading><br/>
  <Heading as="h5" renderIcon={<IconAdminSolid/>}>titleModule</Heading><br/>
  <Heading as="h6" renderIcon={<IconAdminSolid/>}>titleCardLarge</Heading><br/>
</div>

Also I realized the AI variants can have different levels, can you please check these too for the icon sizes and gaps?

<div style={{display: 'flex', flexDirection: 'column', gap: '24px'}}>
  <Heading aiVariant="horizontal" level="h1">Main Title - Heading 1</Heading>
  <Heading aiVariant="horizontal" level="h2">Section Title - Heading 2</Heading>
  <Heading aiVariant="horizontal" level="h3">Nutrition Facts - Heading 3</Heading>
  <Heading aiVariant="horizontal" level="h4">Subsection - Heading 4</Heading>
  <Heading aiVariant="horizontal" level="h5">Detail Category - Heading 5</Heading>
  <Heading aiVariant="horizontal" level="h6">Fine Print - Heading 6</Heading>
</div>
<div style={{display: 'flex', flexDirection: 'column', gap: '24px'}}>
  <Heading aiVariant="horizontal" variant="titlePageDesktop">titlePageDesktop</Heading>
  <Heading aiVariant="horizontal" variant="titlePageMobile">titlePageMobile</Heading>
  <Heading aiVariant="horizontal" variant="titleSection">titleSection</Heading>
  <Heading aiVariant="horizontal" variant="titleCardSection">titleCardSection</Heading>
  <Heading aiVariant="horizontal" variant="titleModule">titleModule</Heading>
  <Heading aiVariant="horizontal" variant="titleCardLarge">titleCardLarge</Heading>
  <Heading aiVariant="horizontal" variant="titleCardRegular">titleCardRegular</Heading>
  <Heading aiVariant="horizontal" variant="titleCardMini">titleCardMini</Heading>
  <Heading aiVariant="horizontal" variant="label">label</Heading>
  <Heading aiVariant="horizontal" variant="labelInline">labelInline</Heading>
</div>

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks for the code snippets! The base ones look great, but in the AI variants the gaps aren’t aligned with the textsizes. Could you use the same gaps we use in the base ones for each heading level?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adamlobler I fixed this, can you please check it now?

static defaultProps = {
children: null,
border: 'none',
color: 'inherit'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now the default text color is "inherit" and as a result it gets the color value from somewhere else from the system, I think it would be more secure to have the "primary" color by default, wdyt?

That's why we have this text color here as well in dark mode:

Image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I chose to modify the examples a bit rather then changing the default "inherit" value because that can have some breaking changes.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see your point, but I’m a bit concerned that these Heading components will mostly receive raw hex values that won’t work across light and dark modes.

Copy link
Contributor Author

@ToMESSKa ToMESSKa Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adamlobler Ok, I changed the default to "primary", check the examples in dark mode please

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@matyasf can you check this conv? I’m not 100% sure about it, but it feels like the safer approach when introducing dark mode.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think too that primary is better. Otherwise users might not set it to set to a wrong color and it will look off/have a11y issues. Be sure to mention this in the changelog (afaik I've done the same for Text)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I put in into the changelog.

@ToMESSKa ToMESSKa force-pushed the INSTUI-4869-heading-rework branch from ed57ffd to 467fc85 Compare January 21, 2026 15:11
Copy link
Collaborator

@adamlobler adamlobler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The icon size and the gap don’t align with the font-size when only the as prop is set.

@ToMESSKa ToMESSKa force-pushed the INSTUI-4869-heading-rework branch from 467fc85 to 464c80a Compare January 22, 2026 12:33
@ToMESSKa ToMESSKa requested a review from adamlobler January 22, 2026 12:48
Copy link
Collaborator

@adamlobler adamlobler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the AI variants the gaps between the icon and the text aren’t aligned with the textsizes, they are always 0.25rem

@ToMESSKa ToMESSKa force-pushed the INSTUI-4869-heading-rework branch from 464c80a to d6810e2 Compare January 23, 2026 09:08
@ToMESSKa ToMESSKa requested a review from adamlobler January 23, 2026 09:20
Copy link
Collaborator

@adamlobler adamlobler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect, thanks for the modifications 🙌

Copy link
Collaborator

@matyasf matyasf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice work!

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.

4 participants