-
-
Notifications
You must be signed in to change notification settings - Fork 52
Separator for dropdown , context and menubar menus #1588
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
Merged
kotAPI
merged 8 commits into
rad-ui:main
from
GoldGroove06:add/separator-to-menu-themed
Sep 20, 2025
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
0f56066
add: separator
GoldGroove06 955bc2a
add: forward ref to comps
GoldGroove06 74f4538
add: styles
GoldGroove06 9c02fa1
add: changeset
GoldGroove06 7a5e9e0
fix: coverage workflow
GoldGroove06 768f14a
revert: coverage workflow
GoldGroove06 109253e
fix: props
GoldGroove06 1262db5
fix: customRootClass
GoldGroove06 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@radui/ui": patch | ||
--- | ||
|
||
Added Separator for dropdown , context and menubar menus |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/components/ui/ContextMenu/fragments/ContextMenuSeparator.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import React, { forwardRef, ElementRef, ComponentPropsWithoutRef } from 'react'; | ||
import Separator from '../../Separator/Separator'; | ||
import ContextMenuContext from '../contexts/ContextMenuContext'; | ||
|
||
export type ContextMenuSeparatorElement = ElementRef<typeof Separator>; | ||
export type ContextMenuSeparatorProps = { | ||
className?: string | ||
}& ComponentPropsWithoutRef<typeof Separator>; | ||
const ContextMenuSeparator = forwardRef<ContextMenuSeparatorElement, ContextMenuSeparatorProps>(({ className, ...props }: ContextMenuSeparatorProps, ref) => { | ||
const context = React.useContext(ContextMenuContext); | ||
if (!context) { | ||
console.warn('ContextMenuSeparator should be used within ContextMenuRoot'); | ||
return null; | ||
} | ||
const { rootClass } = context; | ||
return ( | ||
<Separator ref={ref} customRootClass={rootClass} className={className} {...props}/> | ||
); | ||
}); | ||
|
||
ContextMenuSeparator.displayName = 'ContextMenuSeparator'; | ||
|
||
export default ContextMenuSeparator; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/components/ui/DropdownMenu/fragments/DropdownMenuSeparator.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import React, { forwardRef, ElementRef, ComponentPropsWithoutRef } from 'react'; | ||
import Separator from '../../Separator/Separator'; | ||
import DropdownMenuContext from '../contexts/DropdownMenuContext'; | ||
|
||
export type DropdownMenuSeparatorElement = ElementRef<typeof Separator>; | ||
export type DropdownMenuSeparatorProps = { | ||
className?: string | ||
} & ComponentPropsWithoutRef<typeof Separator>; | ||
|
||
const DropdownMenuSeparator = forwardRef<DropdownMenuSeparatorElement, DropdownMenuSeparatorProps>(({ className, ...props }: DropdownMenuSeparatorProps, ref) => { | ||
const context = React.useContext(DropdownMenuContext); | ||
if (!context) { | ||
console.warn('DropdownMenuSeparator should be used within DropdownMenuRoot'); | ||
return null; | ||
} | ||
const { rootClass } = context; | ||
return ( | ||
<Separator ref={ref} customRootClass={rootClass} className={className} {...props}/> | ||
); | ||
}); | ||
|
||
DropdownMenuSeparator.displayName = 'DropdownMenuSeparator'; | ||
|
||
export default DropdownMenuSeparator; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import React, { forwardRef, ElementRef, ComponentPropsWithoutRef } from 'react'; | ||
import Separator from '../../Separator/Separator'; | ||
import MenubarContext from '../contexts/MenubarContext'; | ||
import clsx from 'clsx'; | ||
|
||
export type MenubarSeparatorElement = ElementRef<typeof Separator>; | ||
export type MenubarSeparatorProps = { | ||
className?: string | ||
} & ComponentPropsWithoutRef<typeof Separator>; | ||
|
||
const MenubarSeparator = forwardRef<MenubarSeparatorElement, MenubarSeparatorProps>(({ className, ...props }: MenubarSeparatorProps, ref) => { | ||
const context = React.useContext(MenubarContext); | ||
if (!context) { | ||
console.warn('MenubarSeparator should be used within MenubarRoot'); | ||
return null; | ||
} | ||
const { rootClass } = context; | ||
|
||
return ( | ||
<Separator ref={ref} customRootClass={rootClass} className={className} {...props}/> | ||
); | ||
}); | ||
|
||
MenubarSeparator.displayName = 'MenubarSeparator'; | ||
|
||
export default MenubarSeparator; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
🛠️ Refactor suggestion
🧩 Analysis chain
Confirm Separator’s styling prop; avoid prop duplication.
Proposed change (if Separator expects className):
Run to verify Separator’s API:
Also applies to: 19-20
🏁 Script executed:
Length of output: 17230
🏁 Script executed:
Length of output: 137
🏁 Script executed:
Length of output: 11543
Pass Menubar root via customRootClass and forward consumer className separately
${rootClass}
, className)}. That pushes consumer classes into the root-prefix/orientation logic instead of appending them as additional classes.<Separator ref={ref} customRootClass={rootClass} className={className} {...props} />
🤖 Prompt for AI Agents
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.
explain it more with some example
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.
@GoldGroove06, let me explain the issue with a detailed example showing why separating
customRootClass
andclassName
is important:Current Problematic Implementation
What Happens Currently
Let's say:
rootClass
from context ="rad-ui-menubar-separator"
className="my-custom-spacing"
Current result:
The Problem
The
Separator
component usescustomRootClass
for internal theming logic (like orientation detection, theme switching). When you merge user classes into it:customRootClass
for orientation keywords, user classes could break thisRecommended Implementation
What Should Happen
Same inputs:
rootClass
="rad-ui-menubar-separator"
className="my-custom-spacing"
Fixed result:
Why This Separation Matters
The
Separator
component can then:customRootClass
for internal theme/orientation logicclassName
as additional user stylesThis same pattern should be applied to
DropdownMenuSeparator
andContextMenuSeparator
as well for consistency.