Skip to content

Commit f2dd88b

Browse files
committed
feat(apollo-vertex): update Alert and Sonner styles and docs
1 parent a96a852 commit f2dd88b

6 files changed

Lines changed: 87 additions & 250 deletions

File tree

apps/apollo-vertex/app/patterns/notifications/in-product/notification-examples.tsx

Lines changed: 5 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -76,20 +76,11 @@ export function SonnerExamples() {
7676
export function AlertExamples() {
7777
return (
7878
<div className="space-y-3">
79-
<Alert status="info" visual="tinted">
79+
<Alert status="default" visual="tinted">
8080
<InfoIcon className="h-4 w-4" />
8181
<AlertTitle>New version available</AlertTitle>
8282
<AlertDescription>
83-
A new version of the platform is ready. Review the changelog for
84-
details.
85-
</AlertDescription>
86-
</Alert>
87-
88-
<Alert status="success" visual="tinted">
89-
<CircleCheckIcon className="h-4 w-4" />
90-
<AlertTitle>Changes saved</AlertTitle>
91-
<AlertDescription>
92-
Your configuration has been updated successfully.
83+
A new version of the platform is ready. Review the changelog for details.
9384
</AlertDescription>
9485
</Alert>
9586

@@ -120,7 +111,7 @@ function DismissibleAlert({
120111
visual = "outline",
121112
}: {
122113
children: ReactNode;
123-
status: "info" | "success" | "warning" | "error";
114+
status: "default" | "warning" | "error";
124115
visual?: "outline" | "tinted" | "subtle";
125116
}) {
126117
const [visible, setVisible] = useState(true);
@@ -147,7 +138,7 @@ export function AlertOutlineExamples() {
147138

148139
return (
149140
<div className="space-y-3" key={resetKey}>
150-
<DismissibleAlert status="info">
141+
<DismissibleAlert status="default">
151142
<InfoIcon className="h-4 w-4" />
152143
<AlertTitle>New version available</AlertTitle>
153144
<AlertDescription>
@@ -156,14 +147,6 @@ export function AlertOutlineExamples() {
156147
</AlertDescription>
157148
</DismissibleAlert>
158149

159-
<DismissibleAlert status="success">
160-
<CircleCheckIcon className="h-4 w-4" />
161-
<AlertTitle>Changes saved</AlertTitle>
162-
<AlertDescription>
163-
Your configuration has been updated successfully.
164-
</AlertDescription>
165-
</DismissibleAlert>
166-
167150
<DismissibleAlert status="warning">
168151
<TriangleAlertIcon className="h-4 w-4" />
169152
<AlertTitle>API rate limit approaching</AlertTitle>
@@ -193,55 +176,6 @@ export function AlertOutlineExamples() {
193176
);
194177
}
195178

196-
// Docs-only: subtle alerts use bg-secondary in light mode to distinguish from the page background
197-
const alertSubtleBgStyles = `
198-
:root:not(.dark) .alert-subtle-bg [data-slot="alert"] {
199-
background-color: var(--secondary) !important;
200-
}
201-
`;
202-
203-
export function AlertDefaultExamples() {
204-
return (
205-
<div className="alert-subtle-bg space-y-3">
206-
<style>{alertSubtleBgStyles}</style>
207-
<Alert status="info" visual="subtle">
208-
<InfoIcon className="h-4 w-4" />
209-
<AlertTitle>New version available</AlertTitle>
210-
<AlertDescription>
211-
A new version of the platform is ready. Review the changelog for
212-
details.
213-
</AlertDescription>
214-
</Alert>
215-
216-
<Alert status="success" visual="subtle">
217-
<CircleCheckIcon className="h-4 w-4" />
218-
<AlertTitle>Changes saved</AlertTitle>
219-
<AlertDescription>
220-
Your configuration has been updated successfully.
221-
</AlertDescription>
222-
</Alert>
223-
224-
<Alert status="warning" visual="subtle">
225-
<TriangleAlertIcon className="h-4 w-4" />
226-
<AlertTitle>API rate limit approaching</AlertTitle>
227-
<AlertDescription>
228-
You have used 90% of your monthly API quota. Consider upgrading your
229-
plan.
230-
</AlertDescription>
231-
</Alert>
232-
233-
<Alert status="error" visual="subtle">
234-
<OctagonXIcon className="h-4 w-4" />
235-
<AlertTitle>Connection failed</AlertTitle>
236-
<AlertDescription>
237-
Unable to reach the server. Check your network connection and try
238-
again.
239-
</AlertDescription>
240-
</Alert>
241-
</div>
242-
);
243-
}
244-
245179
const missingDocs = [
246180
"W-9 Form",
247181
"Proof of Address",
@@ -323,7 +257,7 @@ export function CollapsibleAlertExample() {
323257

324258
export function ActionAlertExample() {
325259
return (
326-
<Alert status="info" visual="outline">
260+
<Alert status="default" visual="outline">
327261
<InfoIcon className="h-4 w-4" />
328262
<AlertTitle>12 documents unclassified</AlertTitle>
329263
<AlertDescription>

apps/apollo-vertex/app/patterns/notifications/in-product/page.mdx

Lines changed: 17 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { SonnerExamples, AlertExamples, AlertOutlineExamples, AlertDefaultExamples, CollapsibleAlertExample, ActionAlertExample } from './notification-examples'
1+
import { SonnerExamples, AlertExamples, AlertOutlineExamples, CollapsibleAlertExample, ActionAlertExample } from './notification-examples'
22
import { LayoutDiagram } from './layout-diagram'
33

44
# In-product notification
@@ -123,22 +123,21 @@ Inline notifications may be persistent or dismissible depending on priority.
123123

124124
### Choosing a visual style
125125

126-
Inline alerts support three visual styles. Choose based on the urgency and importance of the message — not personal preference. Do not mix styles within the same context.
126+
Inline alerts support two visual styles. Choose based on the urgency and importance of the message — not personal preference. Do not mix styles within the same context.
127127

128128
| Style | Variant | When to use | Dismissible |
129129
|---|---|---|---|
130-
| Default | Subtle | Routine info, background updates, non-disruptive confirmations | Optional |
130+
| Default | Tinted | Routine info, background updates, blocking errors, unresolved issues | No |
131131
| Accent | Outline | Contextual warnings, guidance, acknowledged states, unresolved requirements | Context-dependent |
132-
| Bold | Tinted | Critical issues, blocking errors, authentication failures | No |
133132

134-
> When unsure, start with **default**. Escalate only when the message demands immediate attention or blocks progress.
133+
> When unsure, start with **default**. Use Accent only when the message needs a distinct visual call-out.
135134
136-
#### Default (subtle)
135+
#### Default (tinted)
137136

138-
Neutral background with status color on the title and icon. Description text uses the standard muted color. Use for routine information, background updates, and non-disruptive feedback.
137+
Low-opacity status background with neutral title text. Use for critical messages that demand immediate attention or block progress.
139138

140139
<div className="p-4 border rounded-lg mt-4">
141-
<AlertDefaultExamples />
140+
<AlertExamples />
142141
</div>
143142

144143
#### Accent (outline)
@@ -149,14 +148,6 @@ Status color on the border and icon, with default text colors. Use for contextua
149148
<AlertOutlineExamples />
150149
</div>
151150

152-
#### Bold (tinted)
153-
154-
Full status-colored background with white text in dark mode. Use for critical messages that demand immediate attention or block progress.
155-
156-
<div className="p-4 border rounded-lg mt-4">
157-
<AlertExamples />
158-
</div>
159-
160151
### Complex alert patterns (edge cases)
161152

162153
The patterns above cover the majority of notification needs. The following compositions are reserved for complex workflows where a standard alert is not sufficient. Do not use these as defaults — reach for them only when the workflow genuinely requires inline items or embedded actions.
@@ -241,15 +232,15 @@ Each notification has a status that communicates tone and urgency through color
241232

242233
Notification statuses align with the [Badge](/shadcn-components/badge) status system for consistent semantic meaning across the design system.
243234

244-
| Status | Usage | Token | Color | Inline notes |
245-
|---|---|---|---|---|
246-
| `info` | General updates, FYIs | `--info` | `oklch(0.60 0.125 210)` | Best for passive or contextual information |
247-
| `success` | Confirmation of completed tasks | `--success` | `oklch(0.57 0.105 152)` | Inline only when tied to direct user action |
248-
| `warning` | Potential issues or unintended consequences | `--warning` | `oklch(0.80 0.1401 80.82)` | Appropriate for both persistent and action-related messages |
249-
| `error` | Failures, blockers, critical issues | `--destructive` | `oklch(0.62 0.150 18)` | Inline only when tied to validation or error resolution |
235+
| Status | Usage | Token | Color | Sonner | Alert |
236+
|---|---|---|---|---|---|
237+
| `info` | General updates, FYIs | `--info` | `oklch(0.60 0.125 210)` | `toast.info()` | Use `status="default"` |
238+
| `success` | Confirmation of completed tasks | `--success` | `oklch(0.57 0.105 152)` | `toast.success()` | Not available — Sonner only |
239+
| `warning` | Potential issues or unintended consequences | `--warning` | `oklch(0.80 0.1401 80.82)` | `toast.warning()` | `status="warning"` |
240+
| `error` | Failures, blockers, critical issues | `--destructive` | `oklch(0.62 0.150 18)` | `toast.error()` | `status="error"` |
250241

251-
> Inline notifications should use **success** or **error** only when tied to a user-initiated action.
252-
> For persistent system guidance or background alerts, use **info** or **warning**.
242+
> The Alert component supports `status="default"`, `status="warning"`, and `status="error"`. Use Sonner for success confirmations.
243+
> For persistent system guidance or background alerts, use `default` or `warning` in Alert.
253244
254245
---
255246

@@ -341,8 +332,7 @@ Avoid driving users away from their workflow unless necessary.
341332

342333
| Question | Answer | Style |
343334
|---|---|---|
344-
| Is the message routine, informational, or non-disruptive? | Yes | Default (subtle) |
335+
| Is the message routine, informational, or requires immediate attention? | Yes | Default (tinted) |
345336
| Is the message contextual, a warning, or an unresolved requirement? | Yes | Accent (outline) |
346-
| Does the message block progress or require immediate action? | Yes | Bold (tinted) |
347337

348-
> When unsure, start with **default** and escalate only if the message demands it.
338+
> When unsure, use **default**. Use Accent only when the message needs a distinct visual call-out.
Lines changed: 12 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Callout } from 'nextra/components'
2-
import { AlertDefaultExamples, AlertOutlineExamples, AlertExamples, CollapsibleAlertExample, ActionAlertExample } from '@/app/patterns/notifications/in-product/notification-examples'
2+
import { AlertOutlineExamples, AlertExamples, CollapsibleAlertExample, ActionAlertExample } from '@/app/patterns/notifications/in-product/notification-examples'
33

44
# Alert
55

@@ -9,12 +9,12 @@ Displays a callout for user attention.
99
For guidance on when to use Alert vs. Sonner, visual style selection, and content guidelines, see the [In-product notification](/patterns/notifications/in-product) pattern.
1010
</Callout>
1111

12-
### Default (subtle)
12+
### Default (tinted)
1313

14-
Neutral background with status color on the title and icon. Description text uses the standard muted color. Use for routine information, background updates, and non-disruptive feedback.
14+
Low-opacity status background with neutral title text. Use for critical messages that demand immediate attention.
1515

1616
<div className="p-4 border rounded-lg mt-4">
17-
<AlertDefaultExamples />
17+
<AlertExamples />
1818
</div>
1919

2020
### Accent (outline)
@@ -25,14 +25,6 @@ Status-colored border and icon with default text. Dismissible. Use for contextua
2525
<AlertOutlineExamples />
2626
</div>
2727

28-
### Bold (tinted)
29-
30-
Full status-colored background. Use for critical messages that demand immediate attention.
31-
32-
<div className="p-4 border rounded-lg mt-4">
33-
<AlertExamples />
34-
</div>
35-
3628
## Installation
3729

3830
```bash
@@ -45,14 +37,14 @@ npx shadcn@latest add @uipath/alert
4537
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"
4638
```
4739

48-
### Subtle (default)
40+
### Tinted (default)
4941

5042
```tsx
51-
<Alert status="info" visual="subtle">
52-
<InfoIcon className="h-4 w-4" />
53-
<AlertTitle>New version available</AlertTitle>
43+
<Alert status="error" visual="tinted">
44+
<OctagonXIcon className="h-4 w-4" />
45+
<AlertTitle>Connection failed</AlertTitle>
5446
<AlertDescription>
55-
A new version of the platform is ready. Review the changelog for details.
47+
Unable to reach the server. Check your network connection and try again.
5648
</AlertDescription>
5749
</Alert>
5850
```
@@ -69,104 +61,19 @@ import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"
6961
</Alert>
7062
```
7163

72-
### Tinted
73-
74-
```tsx
75-
<Alert status="error" visual="tinted">
76-
<OctagonXIcon className="h-4 w-4" />
77-
<AlertTitle>Connection failed</AlertTitle>
78-
<AlertDescription>
79-
Unable to reach the server. Check your network connection and try again.
80-
</AlertDescription>
81-
</Alert>
82-
```
83-
8464
### Props
8565

8666
| Prop | Type | Default | Description |
8767
|---|---|---|---|
88-
| `status` | `"info" \| "success" \| "warning" \| "error"` || Sets the semantic status color |
68+
| `status` | `"default" \| "warning" \| "error"` || Sets the semantic status color |
8969
| `visual` | `"outline" \| "tinted" \| "subtle"` || Sets the visual treatment |
9070
| `variant` | `"default" \| "destructive"` | `"default"` | Legacy shadcn variant (use `status` + `visual` instead) |
9171

9272
## Complex alert patterns (edge cases)
9373

94-
The following patterns are for workflows that need inline items or embedded actions inside an alert. Use sparingly — standard alerts cover most cases.
95-
96-
### Collapsible content
74+
For guidance on when and how to use these patterns, see [In-product notification](/patterns/notifications/in-product#complex-alert-patterns-edge-cases).
9775

98-
When an alert references a list of items, show them as inline chips. If they overflow a single row, clip to one row and show a "Show all" link. Any `status` can be used with this pattern.
99-
100-
<div className="p-4 border rounded-lg mt-4">
76+
<div className="p-4 border rounded-lg mt-4 space-y-3">
10177
<CollapsibleAlertExample />
102-
</div>
103-
104-
```tsx
105-
import { useState, useRef, useEffect } from "react"
106-
import { Alert, AlertTitle, AlertDescription } from "@/components/ui/alert"
107-
import { Badge } from "@/components/ui/badge"
108-
109-
export function CollapsibleAlertExample() {
110-
const [expanded, setExpanded] = useState(false)
111-
const [overflows, setOverflows] = useState(false)
112-
const [rowHeight, setRowHeight] = useState(0)
113-
const measureRef = useRef<HTMLDivElement>(null)
114-
115-
useEffect(() => {
116-
const el = measureRef.current
117-
if (!el) return
118-
const firstChild = el.firstElementChild as HTMLElement | null
119-
if (!firstChild) return
120-
const singleRow = firstChild.offsetHeight + 6
121-
setRowHeight(singleRow)
122-
setOverflows(el.scrollHeight > singleRow)
123-
}, [])
124-
125-
return (
126-
<Alert status="warning" visual="outline">
127-
<TriangleAlertIcon className="h-4 w-4" />
128-
<AlertTitle className="line-clamp-none">
129-
{items.length} required documents missing
130-
</AlertTitle>
131-
<AlertDescription>
132-
<p>Upload these documents before completing quality check.</p>
133-
<div ref={measureRef} style={{ position: "absolute", visibility: "hidden", left: 0, right: 0 }}
134-
className="flex flex-wrap gap-1.5 mt-2">
135-
{items.map((item) => <Badge key={item} variant="secondary" status="warning">{item}</Badge>)}
136-
</div>
137-
<div style={!expanded && overflows && rowHeight ? { maxHeight: rowHeight, overflow: "hidden" } : {}}
138-
className="flex flex-wrap gap-1.5 mt-2">
139-
{items.map((item) => <Badge key={item} variant="secondary" status="warning">{item}</Badge>)}
140-
</div>
141-
{overflows && (
142-
<button type="button" onClick={() => setExpanded(!expanded)}
143-
className="mt-1.5 text-xs font-medium text-primary hover:underline">
144-
{expanded ? "Show less" : "Show all"}
145-
</button>
146-
)}
147-
</AlertDescription>
148-
</Alert>
149-
)
150-
}
151-
```
152-
153-
### Action button
154-
155-
When an alert can trigger a direct action, place a single button inside the description area. Limit to one action per alert. Any `status` can be used with this pattern.
156-
157-
<div className="p-4 border rounded-lg mt-4">
15878
<ActionAlertExample />
15979
</div>
160-
161-
```tsx
162-
<Alert status="info" visual="outline">
163-
<InfoIcon className="h-4 w-4" />
164-
<AlertTitle>12 documents unclassified</AlertTitle>
165-
<AlertDescription>
166-
<p>Some documents could not be automatically classified.</p>
167-
<Button variant="outline" size="sm" className="mt-1.5">
168-
Filter unclassified
169-
</Button>
170-
</AlertDescription>
171-
</Alert>
172-
```

0 commit comments

Comments
 (0)