diff --git a/demo/e2e/screenshot.spec.ts b/demo/e2e/screenshot.spec.ts index a6296a3ce..b8d00bfc6 100644 --- a/demo/e2e/screenshot.spec.ts +++ b/demo/e2e/screenshot.spec.ts @@ -22,6 +22,7 @@ const routes = [ ...typesPath({ path: '/main/index/action-sheet', name: 'action-sheet' }, actionSheetTypes), ...typesPath({ path: '/main/index/alert', name: 'alert' }, alertTypes), { path: '/main/index/button', name: 'button' }, + { path: '/main/index/toolbar-badge', name: 'toolbar-badge' }, { path: '/main/index/checkbox', name: 'checkbox' }, { path: '/main/index/range', name: 'range' }, ...typesPath({ path: '/main/index/toast', name: 'toast' }, toastTypes), @@ -61,6 +62,16 @@ const prepareScreenShot = async (page: Page, routeName: string) => { ) .toBe(true); + if (routeName === 'toolbar-badge') { + // Keep both directions and the unaffected-control examples in one image. + await page.setViewportSize({ width: 1200, height: 1000 }); + // LTR holds an actual glass-group press; RTL retains the resting group. + const pressed = page.locator('app-toolbar-badge [data-badge-group] ion-button').first(); + await pressed.hover(); + await page.mouse.down(); + await pressed.evaluate((button) => button.classList.add('ion-activated')); + return; + } if (!routeName.includes(':')) { const scrollHeight = await page.locator('ion-content[role="main"]').evaluate(async (el: any) => { const scrollEl = await el.getScrollElement(); diff --git a/demo/e2e/screenshot.spec.ts-snapshots/toolbar-badge-dark.png b/demo/e2e/screenshot.spec.ts-snapshots/toolbar-badge-dark.png new file mode 100644 index 000000000..5feb28b5e Binary files /dev/null and b/demo/e2e/screenshot.spec.ts-snapshots/toolbar-badge-dark.png differ diff --git a/demo/e2e/screenshot.spec.ts-snapshots/toolbar-badge.png b/demo/e2e/screenshot.spec.ts-snapshots/toolbar-badge.png new file mode 100644 index 000000000..2400f833a Binary files /dev/null and b/demo/e2e/screenshot.spec.ts-snapshots/toolbar-badge.png differ diff --git a/demo/src/app/docs/docs-content.generated.ts b/demo/src/app/docs/docs-content.generated.ts index b6d6aa84c..aa8e96858 100644 --- a/demo/src/app/docs/docs-content.generated.ts +++ b/demo/src/app/docs/docs-content.generated.ts @@ -1,3 +1,3 @@ // Generated from docs/special-markup.md. Do not edit directly. export const docsContentHtml = - '
Most Ionic markup works without changes. The combinations below are explicit opt-ins provided by the theme.
\nSolid primary submit buttons use --ion-color-primary-brightness for their foreground and border treatment. Define a value with sufficient contrast for your primary color.
:root {\n --ion-color-primary-brightness: #96feff;\n}<ion-button type="submit" color="primary">Submit</ion-button>\n<ion-button class="button-submit" fill="solid" color="primary">Continue</ion-button>Use .button-submit when the button needs the same treatment but cannot use type="submit".
For iOS alerts and action sheets, set role: 'preferred' on a button to give it a filled --ion-color-primary background and --ion-color-primary-contrast text and icons. While pressed, the background uses --ion-color-primary-shade. This is a theme convention using Ionic's custom button roles; it does not automatically select or invoke the action. Dismissal reports the role as preferred.
const buttons = [\n { text: \'Cancel\', role: \'cancel\' },\n { text: \'Continue\', role: \'preferred\' },\n];Buttons with no role or default keep the normal text color. cancel retains Ionic's cancellation behavior, selected remains a selection state, and destructive uses --ios-theme-destructive-color. An existing confirm role is not treated as preferred. Use preferred for the recommended action, not simply any action that confirms a choice.
The theme follows the centered, unanchored UIAlertController presentation measured on iOS 26.1/26.5. Use ion-popover for an anchored menu. ios-theme-disabled / ios26-disabled retain the original Ionic presentation. Long content remains scrollable. Optional measured animation builders are described in Experimental animation; CSS alone does not replace Ionic's enter/leave animations.
Add one of tab-bar-position-start, tab-bar-position-center, or tab-bar-position-end to an iOS ion-tab-bar to position the whole bar within its safe area. These classes work with both slot="top" and slot="bottom" and preserve the bar's width and press animation. Start and end follow the text direction (reversed in RTL). Without a class, the theme uses its default placement.
<ion-tab-bar slot="bottom" class="tab-bar-position-center">\n <ion-tab-button tab="home">Home</ion-tab-button>\n <ion-tab-button tab="settings">Settings</ion-tab-button>\n</ion-tab-bar>These classes do not reposition a separate ion-fab; leave room for it when choosing the bar's position.
Place an unslotted ion-label immediately alongside an unslotted ion-note to render a two-line item. When using the iOS-style inset-list background, wrap the items in ion-item-group; keep ion-list-header outside the group.
<ion-list inset="true">\n <ion-list-header>\n <ion-label>Connections</ion-label>\n </ion-list-header>\n <ion-item-group>\n <ion-item>\n <ion-label>Network & internet</ion-label>\n <ion-note>Mobile, Wi-Fi, hotspot</ion-note>\n </ion-item>\n </ion-item-group>\n</ion-list>Use slot="end" on ion-note when you want the standard trailing-note layout instead.
Add .item-group-header to an ion-item-group to create the centered icon, title, and description used at the top of the component demo pages.
This is an introductory group. Place regular list items in a separate ion-item-group that follows it.
<ion-list inset="true">\n <ion-item-group class="item-group-header">\n <ion-item>\n <ion-label>\n <ion-icon name="list" style="background: var(--ion-color-primary)"></ion-icon>\n <h2>Lists</h2>\n <ion-text>Inset-list examples</ion-text>\n </ion-label>\n </ion-item>\n </ion-item-group>\n <ion-item-group>\n <ion-item><ion-label>First item</ion-label></ion-item>\n </ion-item-group>\n</ion-list>Add .segment-expand when segment buttons should divide the available width evenly. The class also changes the Liquid Glass effect sizing when registerSegmentEffect is used.
<ion-segment class="segment-expand" value="new">\n <ion-segment-button value="new"><ion-label>New</ion-label></ion-segment-button>\n <ion-segment-button value="replied"><ion-label>Replied</ion-label></ion-segment-button>\n</ion-segment>The theme gives iOS search bars the iOS 26 appearance by default. Add .searchbar-classic to the search field shown beneath a large title in an ion-header with collapse="condense". It uses the conventional filled iOS appearance and collapses with the large title instead of remaining in the fixed header.
Place it in a toolbar with a color, such as color="light"; the classic background is derived from that color's contrast value.
The example uses Ionic's standard collapsible large-title structure. Scroll the preview to collapse the large title and reveal the fixed header.
\n<div class="ion-page">\n <ion-header translucent="true">\n <ion-toolbar color="light">\n <ion-title>Search</ion-title>\n </ion-toolbar>\n </ion-header>\n <ion-content color="light" fullscreen="true">\n <ion-header collapse="condense">\n <ion-toolbar color="light">\n <ion-title size="large">Search</ion-title>\n </ion-toolbar>\n <ion-toolbar color="light">\n <ion-searchbar class="searchbar-classic" placeholder="Filter results"></ion-searchbar>\n </ion-toolbar>\n </ion-header>\n <ion-list inset="true">\n <ion-item-group>\n <ion-item><ion-label>Recent item 1</ion-label></ion-item>\n <ion-item><ion-label>Recent item 2</ion-label></ion-item>\n <ion-item><ion-label>Recent item 3</ion-label></ion-item>\n <ion-item><ion-label>Recent item 4</ion-label></ion-item>\n <ion-item><ion-label>Recent item 5</ion-label></ion-item>\n <ion-item><ion-label>Recent item 6</ion-label></ion-item>\n <ion-item><ion-label>Recent item 7</ion-label></ion-item>\n <ion-item><ion-label>Recent item 8</ion-label></ion-item>\n <ion-item><ion-label>Recent item 9</ion-label></ion-item>\n <ion-item><ion-label>Recent item 10</ion-label></ion-item>\n </ion-item-group>\n </ion-list>\n </ion-content>\n</div>The .ion-page wrapper makes this embedded preview behave like a complete routed page. An application using ion-router-outlet normally receives that page container automatically. The inset list and its items only provide enough content to demonstrate scrolling; they are not required by .searchbar-classic.
Add .toolbar-searchbar when an ion-toolbar combines a search bar with start or end buttons. The class centers the slotted controls and adjusts the spacing around the search field.
<ion-toolbar class="toolbar-searchbar">\n <ion-buttons slot="start">\n <ion-button>Cancel</ion-button>\n </ion-buttons>\n <ion-searchbar></ion-searchbar>\n</ion-toolbar>Add .ios-theme-disabled to an individual Ionic component when it must retain Ionic's standard iOS styling.
<ion-button>iOS 26 theme</ion-button> <ion-button class="ios-theme-disabled">Standard Ionic button</ion-button>For the background model behind inset lists, see Using ion-item-group.
ios26-disabled remains supported as a deprecated alias for ios-theme-disabled.
Most Ionic markup works without changes. The combinations below are explicit opt-ins provided by the theme.
\nSolid primary submit buttons use --ion-color-primary-brightness for their foreground and border treatment. Define a value with sufficient contrast for your primary color.
:root {\n --ion-color-primary-brightness: #96feff;\n}<ion-button type="submit" color="primary">Submit</ion-button>\n<ion-button class="button-submit" fill="solid" color="primary">Continue</ion-button>Use .button-submit when the button needs the same treatment but cannot use type="submit".
Place ion-badge directly inside an ion-button in an ion-toolbar. Both\nstandalone buttons and buttons inside ion-buttons support this markup.\nAn empty badge shows an unread indicator; text such as 3 or 99+ shows a count.\nFor an indicator, keep the contents completely empty (<ion-badge></ion-badge>),\nwithout spaces or line breaks between the tags.
Standalone toolbar button:
\n<ion-toolbar>\n <ion-button slot="end" aria-label="Notifications">\n <ion-icon name="ellipsis-horizontal" slot="icon-only"></ion-icon>\n <ion-badge>3</ion-badge>\n </ion-button>\n</ion-toolbar>Grouped toolbar buttons, with empty, numeric and wide badges:
\n<ion-toolbar>\n <ion-buttons slot="end">\n <ion-button aria-label="Unread notifications">\n <ion-icon name="ellipsis-horizontal" slot="icon-only"></ion-icon>\n <ion-badge></ion-badge>\n </ion-button>\n <ion-button aria-label="3 notifications">\n <ion-icon name="ellipsis-horizontal" slot="icon-only"></ion-icon>\n <ion-badge>3</ion-badge>\n </ion-button>\n <ion-button aria-label="99 or more notifications">\n <ion-icon name="ellipsis-horizontal" slot="icon-only"></ion-icon>\n <ion-badge>99+</ion-badge>\n </ion-button>\n </ion-buttons>\n</ion-toolbar>Use the badge's color property to choose an Ionic color. Setting hidden or\ndisplay: none, or removing the badge, hides it without changing the action's\nlayout. Include the notification state in the action's accessible label.
The treatment is limited to direct-child badges in toolbar buttons. Badges in\ntabs, outside toolbars, or nested in another child keep their existing styling.\nTheme opt-outs on the toolbar, group, button or badge remain supported.
\nFor iOS alerts and action sheets, set role: 'preferred' on a button to give it a filled --ion-color-primary background and --ion-color-primary-contrast text and icons. While pressed, the background uses --ion-color-primary-shade. This is a theme convention using Ionic's custom button roles; it does not automatically select or invoke the action. Dismissal reports the role as preferred.
const buttons = [\n { text: \'Cancel\', role: \'cancel\' },\n { text: \'Continue\', role: \'preferred\' },\n];Buttons with no role or default keep the normal text color. cancel retains Ionic's cancellation behavior, selected remains a selection state, and destructive uses --ios-theme-destructive-color. An existing confirm role is not treated as preferred. Use preferred for the recommended action, not simply any action that confirms a choice.
The theme follows the centered, unanchored UIAlertController presentation measured on iOS 26.1/26.5. Use ion-popover for an anchored menu. ios-theme-disabled / ios26-disabled retain the original Ionic presentation. Long content remains scrollable. Optional measured animation builders are described in Experimental animation; CSS alone does not replace Ionic's enter/leave animations.
Add one of tab-bar-position-start, tab-bar-position-center, or tab-bar-position-end to an iOS ion-tab-bar to position the whole bar within its safe area. These classes work with both slot="top" and slot="bottom" and preserve the bar's width and press animation. Start and end follow the text direction (reversed in RTL). Without a class, the theme uses its default placement.
<ion-tab-bar slot="bottom" class="tab-bar-position-center">\n <ion-tab-button tab="home">Home</ion-tab-button>\n <ion-tab-button tab="settings">Settings</ion-tab-button>\n</ion-tab-bar>These classes do not reposition a separate ion-fab; leave room for it when choosing the bar's position.
Place an unslotted ion-label immediately alongside an unslotted ion-note to render a two-line item. When using the iOS-style inset-list background, wrap the items in ion-item-group; keep ion-list-header outside the group.
<ion-list inset="true">\n <ion-list-header>\n <ion-label>Connections</ion-label>\n </ion-list-header>\n <ion-item-group>\n <ion-item>\n <ion-label>Network & internet</ion-label>\n <ion-note>Mobile, Wi-Fi, hotspot</ion-note>\n </ion-item>\n </ion-item-group>\n</ion-list>Use slot="end" on ion-note when you want the standard trailing-note layout instead.
Add .item-group-header to an ion-item-group to create the centered icon, title, and description used at the top of the component demo pages.
This is an introductory group. Place regular list items in a separate ion-item-group that follows it.
<ion-list inset="true">\n <ion-item-group class="item-group-header">\n <ion-item>\n <ion-label>\n <ion-icon name="list" style="background: var(--ion-color-primary)"></ion-icon>\n <h2>Lists</h2>\n <ion-text>Inset-list examples</ion-text>\n </ion-label>\n </ion-item>\n </ion-item-group>\n <ion-item-group>\n <ion-item><ion-label>First item</ion-label></ion-item>\n </ion-item-group>\n</ion-list>Add .segment-style-glass to give a segment the same glass surface and selected indicator treatment as the tab bar. The class preserves the segment's existing dimensions and text colors, supports scrollable segments, and respects Ionic's public --background property.
<ion-segment class="segment-style-glass" value="available">\n <ion-segment-button value="available">Available</ion-segment-button>\n <ion-segment-button value="away">Away</ion-segment-button>\n</ion-segment>Add .segment-expand when segment buttons should divide the available width evenly. The class also changes the Liquid Glass effect sizing when registerSegmentEffect is used.
<ion-segment class="segment-expand" value="new">\n <ion-segment-button value="new"><ion-label>New</ion-label></ion-segment-button>\n <ion-segment-button value="replied"><ion-label>Replied</ion-label></ion-segment-button>\n</ion-segment>The theme gives iOS search bars the iOS 26 appearance by default. Add .searchbar-classic to the search field shown beneath a large title in an ion-header with collapse="condense". It uses the conventional filled iOS appearance and collapses with the large title instead of remaining in the fixed header.
Place it in a toolbar with a color, such as color="light"; the classic background is derived from that color's contrast value.
The example uses Ionic's standard collapsible large-title structure. Scroll the preview to collapse the large title and reveal the fixed header.
\n<div class="ion-page">\n <ion-header translucent="true">\n <ion-toolbar color="light">\n <ion-title>Search</ion-title>\n </ion-toolbar>\n </ion-header>\n <ion-content color="light" fullscreen="true">\n <ion-header collapse="condense">\n <ion-toolbar color="light">\n <ion-title size="large">Search</ion-title>\n </ion-toolbar>\n <ion-toolbar color="light">\n <ion-searchbar class="searchbar-classic" placeholder="Filter results"></ion-searchbar>\n </ion-toolbar>\n </ion-header>\n <ion-list inset="true">\n <ion-item-group>\n <ion-item><ion-label>Recent item 1</ion-label></ion-item>\n <ion-item><ion-label>Recent item 2</ion-label></ion-item>\n <ion-item><ion-label>Recent item 3</ion-label></ion-item>\n <ion-item><ion-label>Recent item 4</ion-label></ion-item>\n <ion-item><ion-label>Recent item 5</ion-label></ion-item>\n <ion-item><ion-label>Recent item 6</ion-label></ion-item>\n <ion-item><ion-label>Recent item 7</ion-label></ion-item>\n <ion-item><ion-label>Recent item 8</ion-label></ion-item>\n <ion-item><ion-label>Recent item 9</ion-label></ion-item>\n <ion-item><ion-label>Recent item 10</ion-label></ion-item>\n </ion-item-group>\n </ion-list>\n </ion-content>\n</div>The .ion-page wrapper makes this embedded preview behave like a complete routed page. An application using ion-router-outlet normally receives that page container automatically. The inset list and its items only provide enough content to demonstrate scrolling; they are not required by .searchbar-classic.
Add .toolbar-searchbar when an ion-toolbar combines a search bar with start or end buttons. The class centers the slotted controls and adjusts the spacing around the search field.
<ion-toolbar class="toolbar-searchbar">\n <ion-buttons slot="start">\n <ion-button>Cancel</ion-button>\n </ion-buttons>\n <ion-searchbar></ion-searchbar>\n</ion-toolbar>Add .ios-theme-disabled to an individual Ionic component when it must retain Ionic's standard iOS styling.
<ion-button>iOS 26 theme</ion-button> <ion-button class="ios-theme-disabled">Standard Ionic button</ion-button>For the background model behind inset lists, see Using ion-item-group.
ios26-disabled remains supported as a deprecated alias for ios-theme-disabled.
Empty / 3 / 99+ / no badge
+