mirror of
https://github.com/supabase/supabase.git
synced 2026-12-06 08:29:01 +00:00
## What kind of change does this PR introduce? Studio UI cleanup and docs update. Resolves FE-3217. ## What is the current behavior? The table RLS confirmation dialogs differ across the Policies page and Table Editor surfaces. The table editor disable flow also uses a verbose confirmation modal with admonitions and repeated warning copy. | Policies | Table Editor | | --- | --- | | <img width="852" height="448" alt="25125" src="https://github.com/user-attachments/assets/baa9fafa-752c-4701-bf54-40da4e32030b" /> | <img width="1108" height="1016" alt="57354" src="https://github.com/user-attachments/assets/b1b88355-be39-49b9-aed2-a60f20c25104" /> | | <img width="866" height="434" alt="CleanShot 2026-05-15 at 18 01 15@2x" src="https://github.com/user-attachments/assets/d67f69ee-0a49-4dbd-939e-ca968361fc33" /> | <img width="840" height="426" alt="CleanShot 2026-05-15 at 18 01 52@2x" src="https://github.com/user-attachments/assets/a0b5f390-abeb-453f-8636-ad097f22308b" /> | ## What is the new behavior? Table RLS enable and disable confirmations now use one shared concise Alert Dialog treatment across the Policies page, Table Editor header, and Table Editor side panel. The server-backed toggles use the async Alert Dialog action behaviour from the stacked base branch, and the design-system docs now clarify when to start with Alert Dialog versus Confirmation Modal. This PR is stacked on #45960. | Before | After | | --- | --- | | <img width="852" height="448" alt="25125" src="https://github.com/user-attachments/assets/baa9fafa-752c-4701-bf54-40da4e32030b" /> | <img width="864" height="518" alt="CleanShot 2026-05-15 at 18 07 21@2x" src="https://github.com/user-attachments/assets/bda53246-164b-4d5b-81a1-25d3bc661eb3" /> | | <img width="1108" height="1016" alt="57354" src="https://github.com/user-attachments/assets/b1b88355-be39-49b9-aed2-a60f20c25104" /> | <img width="864" height="518" alt="CleanShot 2026-05-15 at 18 07 21@2x" src="https://github.com/user-attachments/assets/bda53246-164b-4d5b-81a1-25d3bc661eb3" /> | | <img width="866" height="434" alt="CleanShot 2026-05-15 at 18 01 15@2x" src="https://github.com/user-attachments/assets/d67f69ee-0a49-4dbd-939e-ca968361fc33" /> | <img width="860" height="488" alt="CleanShot 2026-05-15 at 18 08 41@2x" src="https://github.com/user-attachments/assets/4c67f797-e2cd-4d56-a49d-e6c6fc0edff3" /> | | <img width="840" height="426" alt="CleanShot 2026-05-15 at 18 01 52@2x" src="https://github.com/user-attachments/assets/a0b5f390-abeb-453f-8636-ad097f22308b" /> | <img width="860" height="488" alt="CleanShot 2026-05-15 at 18 08 41@2x" src="https://github.com/user-attachments/assets/4c67f797-e2cd-4d56-a49d-e6c6fc0edff3" /> | <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Refined guidance and wording for dialog usage, clarifying when to use Alert Dialog, Confirmation Modal, and modal modality. * **New Features** * Reworked RLS confirmation flow with a streamlined toggle dialog, clearer messaging, and a “Learn more” link to docs. * **Tests** * Updated end-to-end tests to cover the updated RLS dialog flows and explanatory content. <!-- review_stack_entry_start --> [](https://app.coderabbit.ai/change-stack/supabase/supabase/pull/45961?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack) <!-- review_stack_entry_end --> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
81 lines
3.5 KiB
Plaintext
81 lines
3.5 KiB
Plaintext
---
|
|
title: Confirmation Modal
|
|
description: A modal dialog for confirmations that require additional context or simple interaction.
|
|
component: true
|
|
---
|
|
|
|
Confirmation Modal is a convenience wrapper for confirmation flows that need more body structure
|
|
than a concise Alert Dialog but do not warrant a full custom dialog. It is built on top of
|
|
[Dialog](../components/dialog) and provides a prop-based API for consistent confirmation patterns.
|
|
|
|
Use Confirmation Modal when the user needs extra context to make a decision, such as explanatory copy, callouts, or small form elements, and the action is not so destructive that it requires typed confirmation.
|
|
|
|
If a critical confirmation can be expressed as a single short paragraph, start with
|
|
[Alert Dialog](../components/alert-dialog). If the action is highly destructive and requires
|
|
explicit typed intent, use [Text Confirm Dialog](../fragments/text-confirm-dialog). See
|
|
[Modality](../ui-patterns/modality) for broader guidance on choosing the appropriate pattern.
|
|
|
|
For dirty-form dismissal in dialogs/sheets, use the dedicated discard-confirmation pattern (`DiscardChangesConfirmationDialog` + `useConfirmOnClose`) instead of `ConfirmationModal`. Avoid creating custom wrapper components for this flow; wire `modalProps` from `useConfirmOnClose` directly into `DiscardChangesConfirmationDialog`.
|
|
|
|
<ComponentPreview name="confirmation-modal-demo" peekCode wide />
|
|
|
|
## Usage
|
|
|
|
```tsx
|
|
'use client'
|
|
|
|
import { useState } from 'react'
|
|
import { Button } from 'ui'
|
|
import ConfirmationModal from 'ui-patterns/Dialogs/ConfirmationModal'
|
|
```
|
|
|
|
```tsx
|
|
export default function ConfirmationModalDemo() {
|
|
const [visible, setVisible] = useState(false)
|
|
|
|
return (
|
|
<>
|
|
<Button onClick={() => setVisible(true)}>Show Confirmation Modal</Button>
|
|
|
|
<ConfirmationModal
|
|
visible={visible}
|
|
size="small"
|
|
title="Resume this project"
|
|
confirmLabel="Resume"
|
|
confirmLabelLoading="Resuming"
|
|
cancelLabel="Cancel"
|
|
onConfirm={() => {
|
|
setVisible(false)
|
|
}}
|
|
onCancel={() => {
|
|
setVisible(false)
|
|
}}
|
|
>
|
|
This will resume the project and restart any paused processes.
|
|
</ConfirmationModal>
|
|
</>
|
|
)
|
|
}
|
|
```
|
|
|
|
## Guidelines
|
|
|
|
- **Use for moderate complexity:** Suitable when the confirmation needs extra body content, such as multiple paragraphs, callouts, or simple supporting controls, but does not need typed intent.
|
|
- **Do not use as the default critical confirmation:** Prefer [Alert Dialog](../components/alert-dialog) for short, critical confirmations with a clear confirm/cancel decision.
|
|
- **Do not use for standard dirty-form dismissal:** Prefer `DiscardChangesConfirmationDialog` for unsaved-changes prompts so copy, behavior, and wiring stay consistent across dialogs/sheets.
|
|
- **Avoid critical destruction:** Do not use for irreversible or high-risk actions that could benefit from stronger safeguards.
|
|
- **Keep content focused:** Include only the context needed to make the decision. If the dialog becomes a full flow, use a custom [Dialog](../components/dialog) instead.
|
|
- **Provide clear actions:** Ensure confirm and cancel labels clearly describe the outcome of each choice.
|
|
|
|
## Props
|
|
|
|
- `visible`: Controls open state
|
|
- `title`: Dialog title
|
|
- `description`: Optional description
|
|
- `variant`: 'default' | 'destructive' | 'warning'
|
|
- `loading`: Loading state
|
|
- `onConfirm`: Confirm handler
|
|
- `onCancel`: Cancel handler
|
|
- `alert`: Optional callout (see [Admonition](../fragments/admonition))
|
|
- `children`: Additional content
|