apps/eclipse/content/design-system/components/alert.mdx
import { Alert } from "@prisma/eclipse";
Basic Alert
The Alert component displays important information with a default circle-exclamation icon and the PPG variant.
import { Alert } from "@prisma/eclipse";
export function BasicAlert() {
return (
<Alert>
This is a basic alert message with regular content.
</Alert>
);
}
Alert Variants
The Alert component supports four variants: ppg, error, success, and warning.
import { Alert } from "@prisma/eclipse";
export function AlertVariants() {
return (
<>
<Alert variant="ppg">
PPG variant - for general information and tips.
</Alert>
<Alert variant="success">
Success variant - for positive confirmations.
</Alert>
<Alert variant="warning">
Warning variant - for important notices.
</Alert>
<Alert variant="error">
Error variant - for errors and critical information.
</Alert>
</>
);
}
Custom Icons
You can customize the icon by passing a custom icon component or pass null to hide the icon.
import { Alert } from "@prisma/eclipse";
export function CustomIconAlerts() {
return (
<>
<Alert variant="ppg" icon={<i className="fa-regular fa-terminal h-4 w-4 mt-0.5" />}>
Alert with a custom terminal icon.
</Alert>
<Alert variant="error" icon={<i className="fa-regular fa-circle-exclamation h-4 w-4 mt-0.5" />}>
Alert with a custom error icon.
</Alert>
<Alert variant="success" icon={<i className="fa-regular fa-check h-4 w-4 mt-0.5" />}>
Alert with a custom success icon.
</Alert>
<Alert variant="warning" icon={<i className="fa-regular fa-triangle-exclamation h-4 w-4 mt-0.5" />}>
Alert with a custom warning icon.
</Alert>
<Alert variant="ppg" icon={null}>
Alert without an icon.
</Alert>
</>
);
}
<Alert variant="error" icon={<i className="fa-regular fa-circle-exclamation h-4 w-4 mt-0.5" />}>
Alert with a custom error icon.
</Alert>
<Alert variant="success" icon={<i className="fa-regular fa-check h-4 w-4 mt-0.5" />}>
Alert with a custom success icon.
</Alert>
<Alert variant="warning" icon={<i className="fa-regular fa-triangle-exclamation h-4 w-4 mt-0.5" />}>
Alert with a custom warning icon.
</Alert>
<Alert variant="ppg" icon={null}>
Alert without an icon.
</Alert>
Rich MDX Content
The Alert component accepts and renders any MDX content including headings, paragraphs, lists, links, and code.
import { Alert } from "@prisma/eclipse";
export function RichContentAlert() {
return (
<Alert variant="ppg">
**Getting Started**
Follow these steps to get started:
1. Install the package: `npm install @prisma/client`
2. Initialize Prisma: `npx prisma init`
3. Define your schema and run migrations
For more information, visit the [documentation](https://prisma.io/docs).
</Alert>
);
}
:::ppg Getting Started
Follow these steps to get started:
npm install @prisma/clientnpx prisma initFor more information, visit the documentation. :::
Complex Content Examples
import { Alert } from "@prisma/eclipse";
export function ComplexAlerts() {
return (
<>
<Alert variant="warning">
### Important Update
This feature will be deprecated in version 6.0. Please migrate to the new API:
- Old: `prisma.user.findMany()`
- New: `prisma.user.findMany({ where: {} })`
</Alert>
<Alert variant="error">
**Connection Error**
Unable to connect to the database. Please check:
- Database credentials in `.env`
- Database server is running
- Network connectivity
</Alert>
<Alert variant="success">
Your migration was successful! The following changes were applied:
- Created table `User`
- Added index on `email` column
- Updated foreign key constraints
</Alert>
</>
);
}
variant - Visual style: "ppg", "error", "success", or "warning" (optional, default: "ppg")icon - Custom icon component or null to hide icon (ReactNode | null, optional, default: circle-exclamation icon)className - Additional CSS classes (optional)children - Alert content (any valid MDX/React content) (ReactNode, required)variant="ppg" for general information, tips, and product-specific notesvariant="success" for positive confirmations and successful operationsvariant="warning" for important notices that require attentionvariant="error" for errors, failures, and critical informationicon={null} if the message is self-explanatory without an icon##, ###) to structure complex alert contentThe Alert component is perfect for:
This Alert component is automatically used for MDX alert blocks when configured in your MDX components. The following syntaxes are supported:
:::ppg
This is a PPG alert using MDX alert syntax.
## You can use any MDX content
Including lists, code, and more!
:::
:::error
This is an error alert.
:::
:::success
This is a success alert.
:::
:::warning
This is a warning alert.
:::
:::info
Maps to PPG variant.
:::
:::note
Maps to PPG variant.
:::
:::tip
Maps to success variant.
:::
:::danger
Maps to error variant.
:::
:::ppg
This demonstrates how the :::ppg syntax renders as an Alert component.
You can include:
inline code:::
role="alert" for screen readers