-
-
Notifications
You must be signed in to change notification settings - Fork 95
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
base: main
Are you sure you want to change the base?
Component Revamp 1 #865
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
2 Skipped Deployments
|
sites/reactflow.dev/src/content/learn/tutorials/getting-started-with-react-flow-components.mdx
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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
, andBaseNodeFooter
and remove theselected
prop fromBaseNode
. - 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< |
There was a problem hiding this comment.
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>
Does some of the improvements noted in https://github.com/xyflow/internal/issues/63