Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion cmdk/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ type DialogProps = RadixDialog.DialogProps &
contentClassName?: string
/** Provide a custom element the Dialog should portal into. */
container?: HTMLElement
/** Provide a hidden description text to the Dialog content */
description?: string
}
type ListProps = Children &
DivProps & {
Expand Down Expand Up @@ -880,12 +882,14 @@ const List = React.forwardRef<HTMLDivElement, ListProps>((props, forwardedRef) =
* Renders the command menu in a Radix Dialog.
*/
const Dialog = React.forwardRef<HTMLDivElement, DialogProps>((props, forwardedRef) => {
const { open, onOpenChange, overlayClassName, contentClassName, container, ...etc } = props
const { open, onOpenChange, overlayClassName, contentClassName, container, title, description, ...etc } = props
return (
<RadixDialog.Root open={open} onOpenChange={onOpenChange}>
<RadixDialog.Portal container={container}>
<RadixDialog.Overlay cmdk-overlay="" className={overlayClassName} />
<RadixDialog.Content aria-label={props.label} cmdk-dialog="" className={contentClassName}>
{title && <RadixDialog.Title hidden>{title}</RadixDialog.Title>}
Copy link
Author

Choose a reason for hiding this comment

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

The RadixDialog.Title is set with hidden option, so its appearance doesn't change.

{description && <RadixDialog.Description hidden>{description}</RadixDialog.Description>}
<Command ref={forwardedRef} {...etc} />
</RadixDialog.Content>
</RadixDialog.Portal>
Expand Down