Skip to content

Conversation

Copilot
Copy link

@Copilot Copilot AI commented Oct 14, 2025

Overview

This PR implements comprehensive enhancements to the igx-badge component based on the latest design handoff specifications. The changes introduce a dot property for minimal badge indicators, improved outline rendering, and accessibility improvements to ensure WCAG AA compliance across all themes.

Key Changes

1. Dot Property

Introduced a new boolean dot property that works with any badge type for status indicators:

<igx-badge dot type="success"></igx-badge>
<igx-badge dot outlined type="error"></igx-badge>
  • Added dot as a boolean input property
  • Fixed 8px minimal badge without any content
  • Works with all badge types (primary, info, success, warning, error)
  • Automatically hides value and icon content when dot is enabled
  • Supports outlined style for additional visual flexibility

2. Improved Outline Implementation

Replaced the border-based outline with a proper CSS outline that doesn't affect internal sizing:

Before: box-shadow: inset 0 0 0 2px var(--border-color)
After: outline: 2px solid var(--border-color); outline-offset: -2px

This approach ensures the outline is rendered outside the badge content area without affecting padding or internal element positioning. Theme-specific outline widths are maintained (2px for Material/Fluent/Indigo, 1px for Bootstrap).

3. WCAG AA Accessibility Improvements

Updated foreground colors for colored badge variants to meet WCAG AA contrast requirements:

%igx-badge--success {
    background: color($color: 'success');
    color: white;  // Ensures proper contrast
    
    igx-icon {
        color: white;  // Icon contrast
    }
}

All colored badge types (info, success, warning, error) now use white text and icons to ensure proper contrast ratios.

4. CSS Variable-Driven Sizing

Badge sizing is now controlled entirely by CSS variables from the igniteui-theming dependency:

  • Uses --ig-size CSS variable for size control
  • No component-level size input property
  • Sizes are defined in the igniteui-theming repository and consumed via theme tokens
  • Consistent with the architectural pattern used across other components

5. Theme Compatibility

All enhancements work consistently across all 4 themes:

  • Material
  • Fluent
  • Bootstrap
  • Indigo

API Changes

New Dot Property

@Input({transform: booleanAttribute})
@HostBinding('class.igx-badge--dot')
public dot = false;

Sample Application

Enhanced the badge sample with comprehensive examples:

  • Interactive badge configuration with property panel including dot toggle
  • Dot badge demonstrations with all badge types
  • Complete type variant showcase
  • Avatar integration examples

Testing

  • ✅ Added unit tests for dot property functionality
  • ✅ Tests verify dot works with different badge types
  • ✅ Build verification successful
  • ✅ Linter validation passed

Breaking Changes

None. All changes are backward compatible. Existing badge implementations continue to work unchanged, with new features being opt-in via properties.

Documentation

  • Updated README with new API documentation
  • Added usage examples for dot property with different types
  • Enhanced sample application with visual demonstrations

Fixes #16276

Original prompt

This section details on the original issue you should resolve

<issue_title>Badge enhancements</issue_title>
<issue_description>Enhance the igx-badge component to include new predefined sizes and a new Dot type, implement an improved outline that does not affect the badge’s inner content, update icon and font sizes, and resolve contrast issues to ensure compliance with WCAG AA accessibility standards, following the latest design handoff.

1. Add predefined sizes

  • small
  • medium
  • large

2. Add Dot type

  • Introduce a new Dot type as a minimal badge without any content
  • The Dot type can use any variant (default, info, success, warning, error)

3. Improve outline implementation

  • Replace the current border-based outline with a CSS outline or box-shadow implementation
  • Ensure the outline is rendered outside the badge without affecting its internal size or content

4. Accessibility and contrast improvements

  • Update foreground and background color pairs to meet WCAG AA contrast ratios

5. Visual and design alignment

  • Update icon and font sizes based on the latest Figma handoff
  • Verify spacing, padding, and border radius values align with design tokens

The modifications are valid for all 4 themes.

All details are to be found in the handoff file.
</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #16276


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 5 commits October 14, 2025 09:26
Co-authored-by: kdinev <1472513+kdinev@users.noreply.github.com>
Co-authored-by: kdinev <1472513+kdinev@users.noreply.github.com>
Co-authored-by: kdinev <1472513+kdinev@users.noreply.github.com>
Co-authored-by: kdinev <1472513+kdinev@users.noreply.github.com>
Co-authored-by: kdinev <1472513+kdinev@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] Enhance igx-badge component with new sizes and types Badge enhancements: Add predefined sizes, dot type, improved outline, and WCAG AA compliance Oct 14, 2025
@Copilot Copilot AI requested a review from kdinev October 14, 2025 09:53
Copilot finished work on behalf of kdinev October 14, 2025 09:53
* ```
*/
@Input()
public size: string | IgxBadgeSize = IgxBadgeSize.MEDIUM;
Copy link
Member

Choose a reason for hiding this comment

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

@copilot Unlike the igx-avatar, where the size input is about to be deprecated, the size of components is now driven entirely by css variables coming from the igniteui-theming dependency. The size definitions should be created in the igniteui-theming repository and then the component should consume the new size tokens in it's component theme. There shouldn't be a size input in the component definition.

Copy link
Author

Choose a reason for hiding this comment

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

Updated in commit 0efce73. Removed the size input property and IgxBadgeSize enum. Badge sizing is now controlled entirely by CSS variables (--ig-size) from the igniteui-theming dependency, following the same pattern as other components.

WARNING: 'warning',
ERROR: 'error'
ERROR: 'error',
DOT: 'dot'
Copy link
Member

Choose a reason for hiding this comment

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

@copilot Any of the previous types of badges can also be a dot badge - displaying just as a dot, instead of showing a value, but preserving all other badge type functionality. The dot type should be set separately through a boolean input indicating whether, for example, a success badge is a dot or not.

Copy link
Author

Choose a reason for hiding this comment

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

Updated in commit 0efce73. Changed dot from a type to a boolean input property. Any badge type (primary, info, success, warning, error) can now be displayed as a dot by setting the dot property. Example: <igx-badge dot type="success"></igx-badge>

…operty

Co-authored-by: kdinev <1472513+kdinev@users.noreply.github.com>
@Copilot Copilot AI changed the title Badge enhancements: Add predefined sizes, dot type, improved outline, and WCAG AA compliance Badge enhancements: Add dot property, improved outline, and WCAG AA compliance Oct 14, 2025
@Copilot Copilot AI requested a review from kdinev October 14, 2025 11:09
Copilot finished work on behalf of kdinev October 14, 2025 11:09
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.

Badge enhancements

2 participants