Files
xyflow/examples/astro-xyflow/src/components/ReactFlowInitialExample/CustomNode.tsx
Moritz Klack e5c667d068 Feat(nodes): add initialWidth and initialHeight (#3953)
* feat(react/svelte): add initialWidth/initialHeight closes #3793

* chore(packages): update changelogs
2024-02-27 15:21:35 +01:00

22 lines
569 B
TypeScript

import { memo, useState } from 'react';
import { Handle, Position } from '@xyflow/react';
function CustomNode() {
const [text, setText] = useState('this is a pretty long text');
return (
<>
<Handle type="target" position={Position.Top} />
<div style={{ background: '#eee', padding: 10 }}>
<div>
<input value={text} onChange={(e) => setText(e.target.value)} />
<div>text: {text}</div>
</div>
</div>
<Handle type="source" position={Position.Bottom} />
</>
);
}
export default memo(CustomNode);