The navigation component supports the text or image icon type since version 6.0.0(20).
To configure an image icon or use a common text icon or single-character icon, set the type attribute in the icon settings under titleBar.
Image icon (IconStyleMode.LARGE): applicable to scenarios where a complete image needs to be displayed, such as the app logo, user avatar, promotional image, or customized graphic button.
Text icon (TextStyleMode.NORMAL): a common text button, applicable to scenarios where the text meaning needs to be clearly expressed, such as function options and operation buttons.
Single-character icon (TextStyleMode.SINGLE_CHARACTER): applicable to compact layouts where space needs to be saved. It is often used as the entry for quick actions. It is recommended that this style be used only in scenarios with a single word or letter.

Import required modules.
// Starting from version 6.0.2(22), you do not need to manually import HdsNavigationAttribute. For details, refer to the "Modules to Import" section of the HdsNavigation reference document.
import { TextStyleMode, IconStyleMode, HdsNavigation, HdsNavigationAttribute, HdsNavigationTitleMode } from '@kit.UIDesignKit'; Create a level-1 navigation component. Then set the type attribute under menu in titleBar to set a text icon or specify the size of an image icon.
@Entry
@Component
struct Index {
build() {
HdsNavigation() { // Create the **HdsNavigation** component.
}
.titleBar({
content: {
title: { mainTitle: 'Title' },
subIcon: {
content: {
// Set the user avatar, which is an image icon.
icon: $r('app.media.contacts'), // contacts is a custom resource. You need to replace it with your local resource.
type: IconStyleMode.LARGE,
label: 'subIcon', // Accessibility text
isEnabled: true,
action: () => {
}
}
},
menu: {
// Set the menu content.
value: [{
content: {
// Configure the first menu item as a common text icon.
label: 'Text',
type: TextStyleMode.NORMAL,
isEnabled: true,
componentId: 'menu_1',
action: () => {
}
}
}, {
content: {
// Set the second menu item as a single-character icon.
label: '4',
type: TextStyleMode.SINGLE_CHARACTER,
isEnabled: true,
componentId: 'menu_2',
action: () => {
}
}
}, {
content: {
// Set the third menu item as a common icon.
label: 'largeIcon',
icon: $r('sys.symbol.AI_search'),
type: IconStyleMode.NORMAL,
isEnabled: true,
componentId: 'menu_3',
action: () => {
}
}
}],
maxCount: 3 // Set the maximum number of menu items that can be displayed.
}
}
})
.titleMode(HdsNavigationTitleMode.MINI)
.hideBackButton(true)
}
}