openharmony 鸿蒙 ts-basic-components-toolbaritem

2026-08-25 浏览 (1)

ToolBarItem

You can use the ToolBarItem component to add toolbar items to the title bar using the toolbar universal attribute.

NOTE

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.

Child Components

This component can contain a single child component.

APIs

ToolBarItem

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

NameTypeMandatoryDescription
optionsToolBarItemOptionsNoOptional parameters for ToolBarItem, including the placement parameter of the ToolBarItemPlacement type.
Default value: placement: ToolBarItemPlacement.TOP_BAR_LEADING

Attributes

The universal attributes are not supported.

ToolBarItemOptions

Provides optional parameters for ToolBarItem configuration.

System capability: SystemCapability.ArkUI.ArkUI.Full

NameTypeRead-OnlyOptionalDescription
placementToolBarItemPlacementNoYesPlacement 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.

ToolBarItemPlacement

Enumerates the placement options for toolbar items in the title bar.

System capability: SystemCapability.ArkUI.ArkUI.Full

NameValueDescription
TOP_BAR_LEADING0Places the item at the start of the top bar.
TOP_BAR_TRAILING1Places the item at the end of the top bar.

Example

See toolbar.

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 ts-drawing-components-shape

openharmony 鸿蒙 ts-universal-attributes-sharp-clipping

openharmony 鸿蒙 ts-universal-attributes-toolbar

openharmony 鸿蒙 ts-container-lazyvgridlayout

openharmony 鸿蒙 ohos-arkui-advanced-FoldSplitContainer

openharmony 鸿蒙 ts-methods-calendarpicker-dialog

openharmony 鸿蒙 ts-uicommonevent

openharmony 鸿蒙 ts-basic-gestures-tapgesture

openharmony 鸿蒙 ohos-arkui-advanced-DialogV2

openharmony 鸿蒙 ts-components-canvas-canvas

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/GpSFP6Az