Skip to content

Open-source status page, incident response and uptime monitoring

chore: changelog and variant status badge v2 (#1316)

Maximilian Kaske29205a45e64d
diff --git a/apps/dashboard/src/app/(dashboard)/status-pages/[id]/sidebar.tsx b/apps/dashboard/src/app/(dashboard)/status-pages/[id]/sidebar.tsx
index b79cc7cca..db4c64058 100644
--- a/apps/dashboard/src/app/(dashboard)/status-pages/[id]/sidebar.tsx
+++ b/apps/dashboard/src/app/(dashboard)/status-pages/[id]/sidebar.tsx
@@ -10,24 +10,24 @@ import {
TooltipProvider,
TooltipTrigger,
} from "@/components/ui/tooltip";
+import { useCopyToClipboard } from "@/hooks/use-copy-to-clipboard";
import { useTRPC } from "@/lib/trpc/client";
import { useQuery } from "@tanstack/react-query";
import { ExternalLink } from "lucide-react";
import { useParams } from "next/navigation";
-// NOTE:
-const BADGE_URL =
- "https://openstatus.dev/status-page/hello-world/badge?size=sm&theme=light";
-
export function Sidebar() {
const { id } = useParams<{ id: string }>();
const trpc = useTRPC();
const { data: statusPage } = useQuery(
trpc.page.get.queryOptions({ id: Number.parseInt(id) }),
);
+ const { copy } = useCopyToClipboard();
if (!statusPage) return null;
+ const BADGE_URL = `https://${statusPage.slug}.openstatus.dev/badge/v2`;
+
return (
<SidebarRight
header="Status Page"
@@ -39,7 +39,10 @@ export function Sidebar() {
label: "Slug",
value: (
<Link
- href={`https://${statusPage.customDomain || `${statusPage.slug}.openstatus.dev`}`}
+ href={`https://${
+ statusPage.customDomain ||
+ `${statusPage.slug}.openstatus.dev`
+ }`}
target="_blank"
>
{statusPage.slug}
@@ -63,9 +66,19 @@ export function Sidebar() {
<TooltipProvider>
<Tooltip>
<TooltipTrigger className="align-middle">
- <img className="h-5" src={BADGE_URL} alt="badge" />
+ <img
+ className="h-5 border rounded-sm"
+ src={BADGE_URL}
+ alt="badge"
+ />
</TooltipTrigger>
- <TooltipContent>Learn more about the badge.</TooltipContent>
+ <TooltipContent
+ className="cursor-pointer"
+ side="left"
+ onClick={() => copy(BADGE_URL, { withToast: true })}
+ >
+ {BADGE_URL}
+ </TooltipContent>
</Tooltip>
</TooltipProvider>
),
@@ -111,7 +124,9 @@ export function Sidebar() {
onClick: () =>
typeof window !== "undefined" &&
window.open(
- `https://${statusPage.customDomain || `${statusPage.slug}.openstatus.dev`}`,
+ `https://${
+ statusPage.customDomain || `${statusPage.slug}.openstatus.dev`
+ }`,
"_blank",
),
children: (
diff --git a/apps/docs/src/content/docs/tools/status-badge.mdx b/apps/docs/src/content/docs/tools/status-badge.mdx
index 6fe847bad..34cad2b75 100644
--- a/apps/docs/src/content/docs/tools/status-badge.mdx
+++ b/apps/docs/src/content/docs/tools/status-badge.mdx
@@ -44,11 +44,11 @@ Unknown
This will return a PNG image with the status of your page. It will look like this:
<img src='https://status.openstatus.dev/badge/v2' />
-You can customize the theme by adding `?theme=dark` and the size of it by adding `?size=lg`.
+You can customize the theme by adding `?theme=dark`, the size of it by adding `?size=lg` and the variant `?variant=outline` - use what fits best to you!
Supported themes:
-- `dark`
- `light` (default)
+- `dark`
Supported sizes:
- `sm` (default)
@@ -56,6 +56,12 @@ Supported sizes:
- `lg`
- `xl`
+Supported variants:
+- `default` (default)
+- `outline`
+
+The **outline** variant simply adds a slightly rounded border to the svg `rect`. It mainly can be used for GitHub README or Markdown where styling is not supported.
+
Compared to the PNG badge, we let you define the `border` and `border-radius` of the SVG badge and the font is mono.
It will display the following labels based on the current status of the status page:
diff --git a/apps/web/public/assets/changelog/status-page-badge-v2.png b/apps/web/public/assets/changelog/status-page-badge-v2.png
new file mode 100644
index 000000000..ca3913189
Binary files /dev/null and b/apps/web/public/assets/changelog/status-page-badge-v2.png differ
diff --git a/apps/web/src/app/status-page/[domain]/badge/v2/route.ts b/apps/web/src/app/status-page/[domain]/badge/v2/route.ts
index 38e58eaf5..7bd80e6ae 100644
--- a/apps/web/src/app/status-page/[domain]/badge/v2/route.ts
+++ b/apps/web/src/app/status-page/[domain]/badge/v2/route.ts
@@ -62,6 +62,7 @@ export async function GET(
const params = await props.params;
const { status } = await getStatus(params.domain);
const theme = req.nextUrl.searchParams.get("theme") ?? "light";
+ const variant = req.nextUrl.searchParams.get("variant") ?? "default";
const size = req.nextUrl.searchParams.get("size") ?? "sm";
const { height, padding, gap, radius, fontSize } = SIZE[size] ?? SIZE.sm;
@@ -71,10 +72,13 @@ export async function GET(
const textColor = theme === "dark" ? "#d1d5db" : "#374151";
const bgColor = theme === "dark" ? "#111827" : "#ffffff";
+ const borderColor = variant === "outline" ? "#d1d5db" : "transparent";
const svg = `
<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}">
- <rect width="${width}" height="${height}" fill="${bgColor}"/>
+ <rect x="0.5" y="0.5" width="${width - 1}" height="${
+ height - 1
+ }" fill="${bgColor}" stroke="${borderColor}" stroke-width="1" rx="${radius}" ry="${radius}" />
<text x="${padding}" y="50%" dominant-baseline="middle"
font-family="ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace" font-size="${fontSize}" font-weight="600" fill="${textColor}">
${label}
diff --git a/apps/web/src/content/changelog/status-page-badge-v2.mdx b/apps/web/src/content/changelog/status-page-badge-v2.mdx
new file mode 100644
index 000000000..3f974fbb3
--- /dev/null
+++ b/apps/web/src/content/changelog/status-page-badge-v2.mdx
@@ -0,0 +1,23 @@
+---
+title: Status Page Badge (v2)
+description: Easily integrate the status of your service everywhere.
+image: /assets/changelog/status-page-badge-v2.png
+publishedAt: 2025-08-16
+---
+
+Until now, the badge was a PNG image. Now we provide an SVG instead to make it crystal clear. We are reducing the default style to a minimum.
+
+Just copy the following code and paste it into your website or GitHub README:
+
+```html
+<img src="https://YOUR-SLUG.openstatus.dev/badge/v2" className="border rounded-md overflow-hidden" />
+```
+
+And it will look like this:
+
+<a href="https://status.openstatus.dev">
+ <img src="https://status.openstatus.dev/badge/v2" />
+</a>
+
+
+Read more in our [documentation](https://docs.openstatus.dev/tools/status-badge/#svg-badge-v2).
\ No newline at end of file
diff --git a/apps/web/src/content/changelog/status-page-badge.mdx b/apps/web/src/content/changelog/status-page-badge.mdx
index 538aa7b75..3f4cf9b8e 100644
--- a/apps/web/src/content/changelog/status-page-badge.mdx
+++ b/apps/web/src/content/changelog/status-page-badge.mdx
@@ -1,5 +1,5 @@
---
-title: Status Page SVG Badge
+title: Status Page Badge
description: Easily integrate the status of your service everywhere.
image: /assets/changelog/status-page-badge.jpeg
publishedAt: 2024-05-02