<Panel />
该 <Panel /> 组件可帮助您在视窗上方放置内容。 它被 <MiniMap /> 和 <Controls /> 组件内部使用。
import { ReactFlow, Background, Panel } from '@xyflow/react';
export default function Flow() {
return (
<ReactFlow nodes={[...]} fitView>
<Panel position="top-left">top-left</Panel>
<Panel position="top-center">top-center</Panel>
<Panel position="top-right">top-right</Panel>
<Panel position="bottom-left">bottom-left</Panel>
<Panel position="bottom-center">bottom-center</Panel>
<Panel position="bottom-right">bottom-right</Panel>
</ReactFlow>
);
}属性
对于 TypeScript 用户,<Panel /> 组件的属性类型被导出为 PanelProps。
| 名称 | 类型 |
|---|---|
# position | PanelPosition |
# children | React.ReactNode |
此外,<Panel /> 组件接受 HTML <div /> 元素的所有属性。