8000 Component Revamp 1 by 0x0f0f0f · Pull Request #865 · xyflow/web · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Component Revamp 1 #865

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 27 commits into
base: main
Choose a base branch
from
Draft

Component Revamp 1 #865

wants to merge 27 commits into from

Conversation

0x0f0f0f
Copy link
Contributor
@0x0f0f0f 0x0f0f0f commented Jun 16, 2025

Does some of the improvements noted in https://github.com/xyflow/internal/issues/63

Copy link
vercel bot commented Jun 16, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
example-apps ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 2, 2025 3:01pm
reactflow-website ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 2, 2025 3:01pm
ui-components ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 2, 2025 3:01pm
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
svelteflow-website ⬜️ Ignored (Inspect) Visit Preview Jul 2, 2025 3:01pm
xyflow-website ⬜️ Ignored (Inspect) Visit Preview Jul 2, 2025 3:01pm

@0x0f0f0f
Copy link
Contributor Author
image

Copy link
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR revamps the BaseNode component API by introducing dedicated header, content, and footer slots and updates all tutorials and registry examples to use the new composition pattern (dropping the old selected prop in favor of CSS selectors).

  • Introduce BaseNodeHeader, BaseNodeHeaderTitle, BaseNodeContent, and BaseNodeFooter and remove the selected prop from BaseNode.
  • Update tutorial MDX (getting-started-with-react-flow-components.mdx) to reflect new usage and adjust example code snippets.
  • Refactor all registry and example-apps components (tooltip-node, placeholder-node, num-node, sum-node, base-handle, etc.) to use the new slots API.

Reviewed Changes

Copilot reviewed 31 out of 32 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
sites/reactflow.dev/src/content/learn/tutorials/getting-started-with-react-flow-components.mdx Updated tutorial to use new BaseNode slots and removed selected props; adjusted code fences.
sites/reactflow.dev/src/content/components/nodes/base-node.mdx Expanded MDX docs to list header/content/footer slots and theming guidelines.
apps/ui-components/registry/components/base-node/index.tsx Refactored BaseNode implementation; added CSS selectors for selection state; added slot components.
apps/ui-components/registry/components/tooltip-node/index.tsx Removed selected prop, updated to wrap children in BaseNodeContent.
apps/ui-components/registry/components/placeholder-node/index.tsx Dropped selected prop from PlaceholderNode and updated signature.
apps/ui-components/registry/components/node-header/component-example.tsx Adjusted demo to drop selected prop and use new BaseNode slots.
apps/ui-components/registry/components/labeled-handle/component-example.tsx Removed selected prop in demo, updated BaseNode usage.
apps/ui-components/registry/components/labeled-group-node/index.tsx Removed selected prop, updated component signature.
apps/ui-components/registry/components/database-schema-node/index.tsx Dropped selected prop; simplified return statement.
apps/ui-components/registry/components/base-handle/component-example.tsx Updated demo to drop selected prop on BaseNode.
apps/example-apps/react/tutorials/components/tooltip/components/tooltip-node.tsx Refactored to use forwardRef imports, removed inline React import, dropped selected.
apps/example-apps/react/tutorials/components/tooltip/components/base-node.tsx Updated to use new BaseNode slots and CSS selection logic.
apps/example-apps/react/tutorials/components/sum-node/components/nodes/sum-node.tsx Refactored node header to use BaseNodeHeader and BaseNodeHeaderTitle.
apps/example-apps/react/tutorials/components/sum-node/components/nodes/num-node.tsx Comprehensive refactor to use new BaseNode slot components.
apps/example-apps/react/tutorials/components/complete/components/nodes/sum-node.tsx Same header/footer refactor as above for complete tutorial.
apps/example-apps/react/tutorials/components/complete/components/nodes/num-node.tsx Same header/footer refactor as above for complete tutorial.
apps/example-apps/react/tutorials/components/complete/components/base-node.tsx Updated BaseNode implementation for complete tutorial.
apps/example-apps/react/examples/styling/styled-components/CustomNode.jsx Dropped React import duplicate and moved memo import.
Comments suppressed due to low confidence (2)

sites/reactflow.dev/src/content/learn/tutorials/getting-started-with-react-flow-components.mdx:204

  • Consider restoring the region specifiers (e.g., {1,3,7-11}) on this code fence to ensure the tutorial highlights the intended lines correctly.
```jsx filename="src/App.jsx"

sites/reactflow.dev/src/content/components/nodes/base-node.mdx:21

  • [nitpick] The sentence is missing a preposition for clarity. Consider rephrasing to: '...on interactive components of your node, such as buttons, to disable dragging the node when the user interacts with them.'
interactive components of your node such as buttons, to disable dragging

import { cn } from "@/lib/utils";
import { forwardRef, HTMLAttributes } from "react";

export const BaseNode = forwardRef<
Copy link
Preview
Copilot AI Jul 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] It may be helpful to add a displayName (e.g., BaseNode.displayName = 'BaseNode') for easier debugging and React DevTools identification.

Copilot uses AI. Check for mistakes.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
0