Skip to content

refactor: omit id prop in dialog description and title #3584

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions .changeset/gold-pants-pay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@radix-ui/react-dialog': minor
---

Prevent customizing id directly in Dialog Description and Title
4 changes: 2 additions & 2 deletions packages/react/dialog/src/dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ const TITLE_NAME = 'DialogTitle';

type DialogTitleElement = React.ComponentRef<typeof Primitive.h2>;
type PrimitiveHeading2Props = React.ComponentPropsWithoutRef<typeof Primitive.h2>;
interface DialogTitleProps extends PrimitiveHeading2Props {}
interface DialogTitleProps extends Omit<PrimitiveHeading2Props,"id"> {}

const DialogTitle = React.forwardRef<DialogTitleElement, DialogTitleProps>(
(props: ScopedProps<DialogTitleProps>, forwardedRef) => {
Expand All @@ -451,7 +451,7 @@ const DESCRIPTION_NAME = 'DialogDescription';

type DialogDescriptionElement = React.ComponentRef<typeof Primitive.p>;
type PrimitiveParagraphProps = React.ComponentPropsWithoutRef<typeof Primitive.p>;
interface DialogDescriptionProps extends PrimitiveParagraphProps {}
interface DialogDescriptionProps extends Omit<PrimitiveParagraphProps,"id"> {}

const DialogDescription = React.forwardRef<DialogDescriptionElement, DialogDescriptionProps>(
(props: ScopedProps<DialogDescriptionProps>, forwardedRef) => {
Expand Down