# Dialog

Edit profile

Make changes to your profile here. Click save when you're done.

## Usage This component ships a `dialog()` macro for Jinja and Nunjucks. Basecoat uses the native `` element and `showModal()`. This differs from shadcn/ui's portalled Base UI implementation, but preserves native modality, focus handling, and inert page content without component JavaScript. ```html

Edit profile

Make changes to your profile here. Click save when you're done.

``` ### HTML structure
<button type="button" onclick="dialog.showModal()"> Optional
Trigger button. Basecoat intentionally uses the native HTMLDialogElement.showModal() method.
<dialog class="dialog" id="{ DIALOG_ID }">
Native modal dialog. Add aria-labelledby="{ TITLE_ID }" and aria-describedby="{ DESCRIPTION_ID }" when title and description are present. The macro also adds backdrop-click close handling.
<div>
Dialog content surface.
<header> Optional
Dialog header.
<h2 id="{ TITLE_ID }">
Dialog title. Reference it from aria-labelledby.
<p id="{ DESCRIPTION_ID }"> Optional
Dialog description. Reference it from aria-describedby.
<section> Optional
Dialog body/content area. Add overflow utilities when the body should scroll.
<footer> Optional
Action area. It stacks actions on small screens and aligns them to the end on larger screens.
<button type="button" onclick="this.closest('dialog').close()"> Optional
Close button. You can also wrap a button in <form method="dialog">.
## Examples ### Custom Close Button

Custom close button

The default close icon is hidden and the footer provides the close action.

Use close_button=false and add a close control where it fits your layout.

### No Close Button

No close button

The dialog can still be closed with Escape or a custom action.

Native dialogs remain keyboard-accessible even without the default close icon.

### Sticky Footer

Dialog content row 1. Add enough content to make the body scroll while the footer remains available.

Dialog content row 2. Add enough content to make the body scroll while the footer remains available.

Dialog content row 3. Add enough content to make the body scroll while the footer remains available.

Dialog content row 4. Add enough content to make the body scroll while the footer remains available.

Dialog content row 5. Add enough content to make the body scroll while the footer remains available.

Dialog content row 6. Add enough content to make the body scroll while the footer remains available.

Dialog content row 7. Add enough content to make the body scroll while the footer remains available.

Dialog content row 8. Add enough content to make the body scroll while the footer remains available.

### Scrollable Content

Scrollable Content

Long content can scroll inside the dialog body.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer non nibh sit amet augue commodo ultrices. Row 1.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer non nibh sit amet augue commodo ultrices. Row 2.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer non nibh sit amet augue commodo ultrices. Row 3.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer non nibh sit amet augue commodo ultrices. Row 4.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer non nibh sit amet augue commodo ultrices. Row 5.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer non nibh sit amet augue commodo ultrices. Row 6.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer non nibh sit amet augue commodo ultrices. Row 7.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer non nibh sit amet augue commodo ultrices. Row 8.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer non nibh sit amet augue commodo ultrices. Row 9.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer non nibh sit amet augue commodo ultrices. Row 10.

### RTL Dialog positioning and close button placement use logical properties. Set `dir="rtl"` on the dialog or a parent element.

تعديل الملف الشخصي

قم بتحديث بياناتك ثم احفظ التغييرات.