Skip to content

Add badge support to TabView and refactor icon rendering#428

Open
vdkdamian wants to merge 3 commits into
skiptools:mainfrom
Funico-NV:tabview-badges
Open

Add badge support to TabView and refactor icon rendering#428
vdkdamian wants to merge 3 commits into
skiptools:mainfrom
Funico-NV:tabview-badges

Conversation

@vdkdamian
Copy link
Copy Markdown

@vdkdamian vdkdamian commented May 15, 2026

Thank you for contributing to the Skip project! Please review the contribution guide at https://skip.dev/docs/contributing/ for advice and guidance on making high-quality PRs.

This pull request adds support for tab badges in the TabView component, allowing badges to be displayed on tabs and sections. The implementation introduces a badge property to relevant types, provides new badge modifier methods, and updates rendering logic to show badges using Material3 components on Android.

Tab badge support:

  • Added a badge property to Tab, TabSection, and the TabContent protocol, enabling tabs and tab sections to display badge indicators.
  • Implemented badge rendering in the Compose/Android code path: if a tab has a badge, it is displayed using BadgedBox and Badge from Material3, with proper positioning and styling.
  • Updated tab and section evaluation logic to propagate badge values from modifiers to the tab data structures.

Badge modifier improvements:

  • Implemented badge modifier methods on TabContent, allowing users to easily add badges with different types of content (e.g., count, Text, localized strings). These methods now set the badge property appropriately.
  • Moved the BadgeModifier class from List.swift to AdditionalViewModifiers.swift for better organization and code reuse, and removed the old definition.

Fixes #251

Skip Pull Request Checklist:

  • REQUIRED: I have signed the Contributor Agreement
  • REQUIRED: I have tested my change locally with swift test
  • OPTIONAL: I have tested my change on an iOS simulator or device
  • OPTIONAL: I have tested my change on an Android emulator or device
  • REQUIRED: I have checked whether this change requires a corresponding update in the Skip Fuse UI repository (link related PR if applicable)
  • OPTIONAL: I have added an example of any UI changes in the Showcase sample app

  • AI was used to generate or assist with generating this PR. Please specify below how you used AI to help you, and what steps you have taken to manually verify the changes.

AI was used to help reason about the implementation approach, Compose integration, and architectural consistency with existing SkipUI patterns (such as how List consumes BadgeModifier).

The actual implementation, integration, debugging, and validation were performed manually in Xcode and on-device/emulator builds. I manually verified:

  • Tab(...).badge(...)
  • .tabItem { ... }.badge(...)
  • badge rendering and positioning
  • hidden behavior for .badge(0)
  • integration with existing BadgeModifier infrastructure
  • Android Compose rendering behavior

vdkdamian added 2 commits May 15, 2026 11:29
Move BadgeModifier from List.swift into AdditionalViewModifiers.swift and keep its combined(for:) helper. Add badge support across TabView: import Badge/BadgedBox, add a badge property to TabContent, Tab, and TabSection, propagate badges to section children, and render tab icons inside a BadgedBox when a badge is present. Implement TabContent.badge(...) modifier overloads to set badge values instead of being unavailable, and apply the combined BadgeModifier when building tabs. Remove the duplicate BadgeModifier definition from List.swift.
Rename iconContent to renderIcon and reformat Box initializer for clarity. Import Modifier.offset and apply a small offset (8.dp, -4.dp) to Badge so the badge is positioned correctly over tab icons. Ensure badge content is rendered with a white foregroundStyle for proper contrast. Minor cleanup of render calls to use renderIcon.
@cla-bot
Copy link
Copy Markdown

cla-bot Bot commented May 15, 2026

Thank you for your pull request and welcome to the Skip community. We require contributors to sign our contributor license agreement (CLA), and we don't seem to have the user(s) @vdkdamian on file. In order for us to review and merge your code, for each noted user please add your GitHub username to Skip's .clabot file

Replace the detailed/partial-support row for `.badge` with a simple supported indicator (✅) in README.md. Removes the expandable details noting limited support on `List` and lack of `TabView` support, simplifying the support table entry.
@cla-bot cla-bot Bot added the cla-signed label May 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TabView Badge

1 participant