Alert Dialog
A dialog that requires a user response to proceed.
Derived from the measured dialog frame, surface and motion. The 448px width follows the app's max-w-md dialog.
import { AlertDialog, Button } from "@replicas/ui";
export default function AlertDialogDemo() {
return (
<AlertDialog.Root>
<AlertDialog.Trigger render={<Button>Delete project</Button>} />
<AlertDialog.Popup>
<div style={{ display: "flex", flexDirection: "column", gap: 4, padding: "18px 18.5px 12px" }}>
<AlertDialog.Title>Delete Website redesign?</AlertDialog.Title>
<AlertDialog.Description>
The project, its files and comments will be removed for everyone. This can't be undone.
</AlertDialog.Description>
</div>
<div style={{ display: "flex", justifyContent: "flex-end", gap: 8, padding: 12 }}>
<AlertDialog.Close render={<Button>Cancel</Button>} />
<AlertDialog.Close render={<Button variant="primary">Delete project</Button>} />
</div>
</AlertDialog.Popup>
</AlertDialog.Root>
);
}Prompt
Copy Prompt hands your agent everything it needs to build the Alert Dialog in the Laravel Cloud style: the measured tokens, the CSS and the structure.
Show Prompt
# Laravel Cloud Alert Dialog
A dialog that requires a user response to proceed.
Build a Alert Dialog in this project that looks and behaves like Laravel Cloud's. Measured from the running Laravel Cloud app (cloud.laravel.com). Keep every value exact. Map the tokens onto the project's own theme variables instead of hard-coding them. Use the project's own component library for behaviour, or [Base UI](https://base-ui.com/react/components/alert-dialog) if it has none.
Fidelity: Derived from the measured dialog frame, surface and motion. The 448px width follows the app's max-w-md dialog.
## Tokens
| Token | Light | Dark |
| --- | --- | --- |
| `--text-color-default` | `var(--slate-dark-11)` | `var(--slate-dark-11)` |
| `--text-color-strong` | `var(--slate-dark-12)` | `var(--slate-dark-12)` |
| `--background-color-default` | `var(--slate-dark-2)` | `var(--slate-dark-2)` |
| `--shadow-xs` | `0 0 1px 0 #0000004d, 0 1px 2px 0 #00000066` | `0 0 1px 0 #0000004d, 0 1px 2px 0 #00000066` |
| `--shadow-dialog-surface` | `0 0 0 1px var(--slate-dark-alpha-6), 0 0 0 7px #ffffff0d, 0 64px 24px 0 #0000, 0 44px 22px 0 #0000000d, 0 28px 20px 0 #00000033, 0 17px 17px 0 #00000052, 0 10px 13px 0 #00000066` | `0 0 0 1px var(--slate-dark-alpha-6), 0 0 0 7px #ffffff0d, 0 64px 24px 0 #0000, 0 44px 22px 0 #0000000d, 0 28px 20px 0 #00000033, 0 17px 17px 0 #00000052, 0 10px 13px 0 #00000066` |
| `--overlay` | `rgb(0 0 0 / 0.5)` | `rgb(0 0 0 / 0.5)` |
## CSS
Scoped under `[data-style="laravel"]`; dark rules sit under `[data-theme="dark"]`. The `ui-*` classes and data attributes match the structure below.
```css
[data-style="laravel"] {
.ui-alert-dialog-backdrop {
position: fixed;
inset: 0;
background-color: var(--overlay);
transition: opacity var(--duration-dialog) var(--ease-dialog);
&[data-starting-style],
&[data-ending-style] {
opacity: 0;
}
}
.ui-alert-dialog-popup {
box-sizing: border-box;
position: fixed;
top: 25%;
left: 50%;
translate: -50% -25%;
width: calc(100vw - 32px);
max-width: 448px;
max-height: calc(100dvh - 12%);
padding: 8px;
border-radius: var(--radius-3xl);
background-color: color-mix(in srgb, var(--background-color-default) 60%, transparent);
box-shadow: var(--shadow-xs);
backdrop-filter: blur(1px);
color: var(--text-color-default);
font-family: var(--font-sans);
font-size: var(--text-sm);
line-height: 20px;
outline: none;
transition: all var(--duration-dialog) var(--ease-in-out);
animation: laravel-dialog-in var(--duration-dialog) var(--ease-dialog);
&::before {
content: "";
position: absolute;
inset: 8px;
z-index: -1;
border-radius: var(--radius-2xl);
background-color: var(--background-color-default);
box-shadow: var(--shadow-dialog-surface);
transition: all var(--duration-dialog) var(--ease-in-out);
}
&[data-ending-style] {
animation: laravel-dialog-out var(--duration-dialog) var(--ease-dialog) forwards;
}
}
.ui-alert-dialog-title {
margin: 0;
color: var(--text-color-strong);
font-size: var(--text-base);
font-weight: var(--font-weight-medium);
line-height: 24px;
}
.ui-alert-dialog-description {
margin: 0;
color: var(--text-color-default);
font-size: var(--text-sm);
line-height: 20px;
}
}
```
## Structure
How Replicas assembles it on Base UI.
```tsx
import { AlertDialog as BaseAlertDialog } from "@base-ui/react/alert-dialog";
import { usePortalContainer } from "./portal";
const join = (base: string, extra?: string) => (extra ? `${base} ${extra}` : base);
function Popup({ className, ...props }: Omit<BaseAlertDialog.Popup.Props, "className"> & { className?: string }) {
return (
<BaseAlertDialog.Portal container={usePortalContainer()}>
<BaseAlertDialog.Backdrop className="ui-alert-dialog-backdrop" />
<BaseAlertDialog.Popup className={join("ui-alert-dialog-popup", className)} {...props} />
</BaseAlertDialog.Portal>
);
}
function Title({ className, ...props }: Omit<BaseAlertDialog.Title.Props, "className"> & { className?: string }) {
return <BaseAlertDialog.Title className={join("ui-alert-dialog-title", className)} {...props} />;
}
function Description({
className,
...props
}: Omit<BaseAlertDialog.Description.Props, "className"> & { className?: string }) {
return <BaseAlertDialog.Description className={join("ui-alert-dialog-description", className)} {...props} />;
}
export const AlertDialog = {
Root: BaseAlertDialog.Root,
Trigger: BaseAlertDialog.Trigger,
Close: BaseAlertDialog.Close,
Popup,
Title,
Description,
};
```
## Example
```tsx
import { AlertDialog, Button } from "@replicas/ui";
export default function AlertDialogDemo() {
return (
<AlertDialog.Root>
<AlertDialog.Trigger render={<Button>Delete project</Button>} />
<AlertDialog.Popup>
<div style={{ display: "flex", flexDirection: "column", gap: 4, padding: "18px 18.5px 12px" }}>
<AlertDialog.Title>Delete Website redesign?</AlertDialog.Title>
<AlertDialog.Description>
The project, its files and comments will be removed for everyone. This can't be undone.
</AlertDialog.Description>
</div>
<div style={{ display: "flex", justifyContent: "flex-end", gap: 8, padding: 12 }}>
<AlertDialog.Close render={<Button>Cancel</Button>} />
<AlertDialog.Close render={<Button variant="primary">Delete project</Button>} />
</div>
</AlertDialog.Popup>
</AlertDialog.Root>
);
}
```
## Foundations
The rest of the Laravel Cloud style, as a skill: https://replicas.raphaelsalaja.com/skills/laravel/SKILL.md