From 6b4ff221c8a3fa13ec4af1fcf80e2fc8617bc224 Mon Sep 17 00:00:00 2001 From: Peter Pal Hudak Date: Thu, 1 Oct 2026 17:05:35 +0200 Subject: [PATCH] feat(ui-heading): add AI Heading iconOnly sizes for every Heading variant MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit aiVariant="iconOnly" now sizes its AI icon per variant to match the Figma spec (32, 24, 20, and 16px) instead of reusing the horizontal lockup sizes. Level and as sizing are unchanged. Existing iconOnly headings that set a variant render a slightly larger icon. Generalize the AI Heading README section and add the sizes to the regression-test page. INSTUI-5190 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 5.5 --- packages/ui-heading/src/Heading/v2/README.md | 67 ++++++++++++++++++-- packages/ui-heading/src/Heading/v2/index.tsx | 30 ++++++++- regression-test/src/app/heading/page.tsx | 22 +++++++ 3 files changed, 112 insertions(+), 7 deletions(-) diff --git a/packages/ui-heading/src/Heading/v2/README.md b/packages/ui-heading/src/Heading/v2/README.md index b9aaee9d0b..2e63ebf7df 100644 --- a/packages/ui-heading/src/Heading/v2/README.md +++ b/packages/ui-heading/src/Heading/v2/README.md @@ -42,19 +42,78 @@ type: example ### AI Heading -Pre-configured and with unique styles, the `ai-headings` are used for standardized, ai-related components. +Use the `aiVariant` prop for headings of AI-related content, such as a Modal or Popover header. Use a standard Heading for all other headings. + +`stacked` and `horizontal` show the IgniteAI logo lockup before the heading text: ```js --- type: example ---
- Nutrition Facts - Nutrition Facts - Nutrition Facts + Stacked AI heading + Horizontal AI heading +
+``` + +`iconOnly` shows only the AI icon, and it comes in the same sizes as the standard Heading. Set the size with the `variant` or `level` prop, and the icon scales to match: + +```js +--- +type: example +--- +
+ titlePageDesktop + titlePageMobile + titleSection + titleCardSection + titleModule + titleCardLarge + titleCardRegular + titleCardMini + label
``` +For example, in a Modal header: + +```js +--- +type: example +--- +const Example = () => { + const [open, setOpen] = useState(false) + return ( +
+ + setOpen(false)} + size="small" + label="Summarize with AI" + > + + setOpen(false)} + screenReaderLabel="Close" + /> + + Summarize with AI + + + + The AI-generated summary goes here. + + +
+ ) +} + +render() +``` + ### Heading level What DOM element is output is determined in the following order: diff --git a/packages/ui-heading/src/Heading/v2/index.tsx b/packages/ui-heading/src/Heading/v2/index.tsx index 570a2b3bae..33e2882752 100644 --- a/packages/ui-heading/src/Heading/v2/index.tsx +++ b/packages/ui-heading/src/Heading/v2/index.tsx @@ -99,6 +99,22 @@ const variantToAIHorizontalIconSize: Record< labelInline: 'xs' } +const variantToAIIconOnlySize: Record< + NonNullable, + 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' +> = { + titlePageDesktop: 'xl', + titlePageMobile: 'xl', + titleSection: 'xl', + titleCardSection: 'lg', + titleModule: 'lg', + titleCardLarge: 'lg', + titleCardRegular: 'md', + titleCardMini: 'sm', + label: 'sm', + labelInline: 'sm' +} + const levelToAIHorizontalIconSize: Record< Exclude, 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' @@ -159,10 +175,12 @@ class Heading extends Component { this.checkProps() } - getIconSize(forAIHorizontal = false) { + getIconSize(aiMode?: 'horizontal' | 'iconOnly') { const { variant, level, as } = this.props + const forAIHorizontal = !!aiMode if (variant) { + if (aiMode === 'iconOnly') return variantToAIIconOnlySize[variant] return forAIHorizontal ? variantToAIHorizontalIconSize[variant] : variantToIconSize[variant] @@ -211,7 +229,10 @@ class Heading extends Component { return (