Loading...

Toolbar.

import { Menu, Toolbar } from '@antv/x6-react-components'
import '@antv/x6-react-components/es/menu/style/index.css'
import '@antv/x6-react-components/es/toolbar/style/index.css'
const Item = Toolbar.Item
const Group = Toolbar.Group
<Toolbar onClick={this.onClick} extra={<span>>Extra Component</span>}>
<Group>
<Item name="zoomIn" tooltip="Zoom In (Cmd +)" icon={<ZoomInOutlined />} />
<Item name="zoomOut" tooltip="Zoom Out (Cmd -)" icon={<ZoomOutOutlined />} />
</Group>
<Group>
<Item name="undo" tooltip="Undo (Cmd + Z)" icon={<UndoOutlined />} />
<Item name="redo" tooltip="Redo (Cmd + Shift + Z)" icon={<RedoOutlined />} />
</Group>
<Group>
<Item name="delete" icon={<DeleteOutlined />} disabled={true} tooltip="Delete (Delete)" />
</Group>
<Group>
<Item name="bold" icon={<BoldOutlined />} active={true} tooltip="Bold (Cmd + B)" />
<Item name="italic" icon={<ItalicOutlined />} tooltip="Italic (Cmd + I)" />
<Item name="strikethrough" icon={<StrikethroughOutlined />} tooltip="Strikethrough (Cmd + Shift + x)" />
<Item name="underline" icon={<UnderlineOutlined />} tooltip="Underline (Cmd + U)" />
</Group>
</Toolbar>

Toolbar

ParameterDescriptionTypeDefault Value
classNameCustom style namestring-
extraAdditional components on the right side of the toolbarReactNode-
sizeSize of the toolbar'small' | 'big'-
alignTool alignment method'left' | 'right'-
hoverEffectWhether to show a rounded background on mouse hoverbooleanfalse
onClickCallback function when the toolbar is clicked(name: string, value?: any) => void-

Toolbar.Group

ParameterDescriptionTypeDefault Value
classNameCustom style namestring-

Toolbar.Item

ParameterDescriptionTypeDefault Value
classNameCustom style namestring-
nameName of the tool itemstring-
iconIcon for the tool itemReactNode-
textDisplayed textstring | ReactNode-
hiddenWhether to hideboolean-
disabledWhether to disableboolean-
activeWhether it is activatedboolean-
tooltipTooltip textstring-
tooltipPropsOptions for the Tooltip componentTooltipProps-
tooltipAsTitleWhether to use the tooltip text as the title attribute of the tool itemboolean-
dropdownDropdown menuReactNode-
dropdownArrowWhether to show the dropdown menu arrowboolean-
dropdownOptions for the DropdownDropdown.Props-
onClickCallback function when the tool item is clicked(name?: string) => void-