You can use the ToolBarItem component to add toolbar items to the title bar using the toolbar universal attribute.
This component is supported since API version 20. Updates will be marked with a superscript to indicate their earliest API version.
This component is typically used with the toolbar universal attribute.
ToolBarItem(options?: ToolBarItemOptions)
Creates a toolbar item at the beginning of the corresponding column in the title bar by default. The column position is determined by the component's toolbar attribute configuration.
System capability: SystemCapability.ArkUI.ArkUI.Full
Parameters
| Name | Type | Mandatory | Description |
|---|---|---|---|
| options | ToolBarItemOptions | No | Optional parameters for ToolBarItem, including the placement parameter of the ToolBarItemPlacement type. Default value: placement: ToolBarItemPlacement.TOP_BAR_LEADING |
Provides optional parameters for ToolBarItem configuration.
System capability: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| placement | ToolBarItemPlacement | No | Yes | Placement position of the toolbar item. Default value: ToolBarItemPlacement.TOP_BAR_LEADING. ToolBarItemPlacement.TOP_BAR_LEADING: places the item at the start of the top bar. ToolBarItemPlacement.TOP_BAR_TRAILING: places the item at the end of the top bar. |