Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 14, 2025

Closes #16276

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 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 AI requested a review from kdinev October 14, 2025 09:53
kdinev
kdinev previously requested changes Oct 14, 2025
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 AI requested a review from kdinev October 14, 2025 11:09
@kdinev kdinev requested a review from Copilot October 17, 2025 14:00
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances igx-badge with a new dot variant, updates outline rendering to use CSS outlines, and adjusts colors to achieve WCAG AA contrast. Key updates also introduce CSS variable-driven sizing and expand samples, tests, and documentation.

  • Add dot property with styling and tests
  • Replace inset box-shadow outline with outline/outline-offset; update theme colors for contrast
  • Use CSS variables for sizing; update samples and README

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/app/badge/badge.sample.ts Adds dot control to the sample property panel; minor variant mapping edit
src/app/badge/badge.sample.scss Updates sample layout and positions badges on avatars
src/app/badge/badge.sample.html Adds interactive, dot, and type variant examples
projects/igniteui-angular/src/lib/core/styles/components/badge/_badge-theme.scss Implements CSS variable sizing, outline using outline/offset, color contrast updates, and dot styles
projects/igniteui-angular/src/lib/core/styles/components/badge/_badge-component.scss Wires the dot modifier to the dot placeholder styles
projects/igniteui-angular/src/lib/badge/badge.component.ts Introduces the dot @input with HostBinding
projects/igniteui-angular/src/lib/badge/badge.component.spec.ts Adds tests for dot initialization and with success type
projects/igniteui-angular/src/lib/badge/README.md Documents the dot property and examples; mentions sizes

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@SisIvanova SisIvanova marked this pull request as ready for review October 22, 2025 13:01
@SisIvanova SisIvanova added the ❌ status: awaiting-test PRs awaiting manual verification label Oct 22, 2025
@simeonoff simeonoff changed the title Badge enhancements: Add dot property, improved outline, and WCAG AA compliance feat(badge): design enhancement Oct 23, 2025
@simeonoff simeonoff requested review from Copilot and removed request for Copilot October 23, 2025 15:25
@yradoeva

This comment was marked as resolved.

@simeonoff simeonoff added ✅ status: verified Applies to PRs that have passed manual verification and removed ❌ status: awaiting-test PRs awaiting manual verification labels Oct 30, 2025
@simeonoff simeonoff dismissed kdinev’s stale review October 30, 2025 13:34

All requested changes have been addressed.

@simeonoff simeonoff merged commit c32d22e into master Oct 30, 2025
6 checks passed
@simeonoff simeonoff deleted the copilot/enhance-igx-badge-component branch October 30, 2025 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

badge Badge component design: verified ✨ themes version: 21.0.x ✅ status: verified Applies to PRs that have passed manual verification

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Badge enhancements

9 participants