显示在页面上方的模态对话框窗口。
¥API Reference
此组件继承了 对话框基础组件 的属性。
¥This component inherits props from the Dialog primitive.
Note that this dialog is designed around the modal pattern, so the modal
prop is unavailable.
¥Root
包含对话框的所有部分。
¥Contains all the parts of a dialog.
¥Trigger
封装将打开对话框的控件。
¥Wraps the control that will open the dialog.
¥Content
包含对话框的内容。此组件基于 div
元素。
¥Contains the content of the dialog. This component is based on the div
element.
¥Title
对话框打开时会显示可访问的标题。这部分基于 标题 组件,具有预定义的字体大小和顶部的行距修剪。
¥An accessible title that is announced when the dialog is opened. This part is based on the Heading component with a pre-defined font size and leading trim on top.
¥Description
一个可选的可访问描述,在对话框打开时显示。这部分基于 文本 组件,具有预定义的字体大小。
¥An optional accessible description that is announced when the dialog is opened. This part is based on the Text component with a pre-defined font size.
如果你想完全删除描述,请删除此部分并将 aria-describedby={undefined}
传递给 Content
。
¥If you want to remove the description entirely, remove this part and pass aria-describedby={undefined}
to Content
.
¥Close
封装将关闭对话框的控件。
¥Wraps the control that will close the dialog.
¥Examples
¥Size
使用 size
属性控制对话框的大小。它会影响内容的 padding
和 border-radius
。与 width
、minWidth
和 maxWidth
props 结合使用,以控制对话框的宽度。
¥Use the size
prop to control size of the dialog. It will affect the padding
and border-radius
of the Content.
Use it in conjunction with the width
, minWidth
and maxWidth
props to control the width of the dialog.
¥With inset content
使用 插入 组件将内容与对话框边缘对齐。
¥Use the Inset component to align content flush with the sides of the dialog.