From 9e07a4beeeb26632d0f680d8e39348473648af57 Mon Sep 17 00:00:00 2001
From: dangreen
Date: Tue, 1 Dec 2026 01:04:44 +0400
Subject: [PATCH 01/10] docs: drop the table of contents that lists only the
page title
Starlight starts every table of contents with the page title, so 30 pages without headings showed "On this page" with "Overview" alone. The right sidebar stays in place, so the content does not move between pages.
---
website/astro.config.js | 3 ++-
website/src/components/PageSidebar.astro | 9 +++++++++
website/src/styles/global.css | 5 +++++
3 files changed, 16 insertions(+), 1 deletion(-)
create mode 100644 website/src/components/PageSidebar.astro
diff --git a/website/astro.config.js b/website/astro.config.js
index a3e6ff2c8..e3e472ca9 100644
--- a/website/astro.config.js
+++ b/website/astro.config.js
@@ -74,7 +74,8 @@ export default defineConfig({
baseUrl: 'https://github.com/reactchartjs/react-chartjs-2/edit/master/website/'
},
components: {
- Sidebar: './src/components/Sidebar.astro'
+ Sidebar: './src/components/Sidebar.astro',
+ PageSidebar: './src/components/PageSidebar.astro'
},
plugins: [
llmsTxt({
diff --git a/website/src/components/PageSidebar.astro b/website/src/components/PageSidebar.astro
new file mode 100644
index 000000000..fd2d1affd
--- /dev/null
+++ b/website/src/components/PageSidebar.astro
@@ -0,0 +1,9 @@
+---
+import Default from '@astrojs/starlight/components/PageSidebar.astro'
+
+const [title, ...headings] = Astro.locals.starlightRoute.toc?.items ?? []
+// A table of contents with the page title alone has nothing to navigate
+const hasContents = !(title?.children.length === 0 && headings.length === 0)
+---
+
+{hasContents ? : }
diff --git a/website/src/styles/global.css b/website/src/styles/global.css
index 095be244b..68f2b4dc1 100644
--- a/website/src/styles/global.css
+++ b/website/src/styles/global.css
@@ -15,6 +15,11 @@
margin-top: 1.5rem;
}
+/* No bar for a table of contents that is not shown */
+:root:has(.rc2-no-toc) {
+ --sl-mobile-toc-height: 0rem;
+}
+
/* The logo sits beside the intro of the home page */
.sl-markdown-content .rc2-logo {
float: right;
From 2825219915f625528b81ed81a967791b2d041864 Mon Sep 17 00:00:00 2001
From: dangreen
Date: Tue, 1 Dec 2026 01:04:47 +0400
Subject: [PATCH 02/10] docs: move the ad to the right sidebar
At the end of the left sidebar the ad stood after 46 links, out of view. It sits under the table of contents now, and under the text of the page on screens without the right sidebar. Only the block that fits the screen stays in the page, so a single ad loads. The blocks keep neutral names, which ad blockers do not hide, as on the old website.
---
website/astro.config.js | 4 +-
website/src/components/Bwndw.astro | 47 ++++++++++++++++++++++++
website/src/components/Footer.astro | 16 ++++++++
website/src/components/PageSidebar.astro | 2 +
website/src/components/Sidebar.astro | 27 --------------
website/src/styles/global.css | 35 +++++++++++++++++-
6 files changed, 100 insertions(+), 31 deletions(-)
create mode 100644 website/src/components/Bwndw.astro
create mode 100644 website/src/components/Footer.astro
delete mode 100644 website/src/components/Sidebar.astro
diff --git a/website/astro.config.js b/website/astro.config.js
index e3e472ca9..317e786fa 100644
--- a/website/astro.config.js
+++ b/website/astro.config.js
@@ -74,8 +74,8 @@ export default defineConfig({
baseUrl: 'https://github.com/reactchartjs/react-chartjs-2/edit/master/website/'
},
components: {
- Sidebar: './src/components/Sidebar.astro',
- PageSidebar: './src/components/PageSidebar.astro'
+ PageSidebar: './src/components/PageSidebar.astro',
+ Footer: './src/components/Footer.astro'
},
plugins: [
llmsTxt({
diff --git a/website/src/components/Bwndw.astro b/website/src/components/Bwndw.astro
new file mode 100644
index 000000000..de9621f11
--- /dev/null
+++ b/website/src/components/Bwndw.astro
@@ -0,0 +1,47 @@
+---
+interface Props {
+ /** The id of the block, unique on the page. */
+ id: string
+ /** Whether the block is for wide screens, which show the right sidebar, or for the others. */
+ wide: boolean
+ class?: string
+}
+
+const { id, wide, class: className } = Astro.props
+---
+
+
+
+
+
diff --git a/website/src/components/Footer.astro b/website/src/components/Footer.astro
new file mode 100644
index 000000000..600c3657b
--- /dev/null
+++ b/website/src/components/Footer.astro
@@ -0,0 +1,16 @@
+---
+import Default from '@astrojs/starlight/components/Footer.astro'
+import Bwndw from './Bwndw.astro'
+
+// The pages with the right sidebar, where the other block is
+const { toc } = Astro.locals.starlightRoute
+---
+
+{toc && (
+ <>
+
+ {/* After both blocks, so the one that does not fit the screen is gone when it runs */}
+
+ >
+)}
+
diff --git a/website/src/components/PageSidebar.astro b/website/src/components/PageSidebar.astro
index fd2d1affd..6d24dbe68 100644
--- a/website/src/components/PageSidebar.astro
+++ b/website/src/components/PageSidebar.astro
@@ -1,5 +1,6 @@
---
import Default from '@astrojs/starlight/components/PageSidebar.astro'
+import Bwndw from './Bwndw.astro'
const [title, ...headings] = Astro.locals.starlightRoute.toc?.items ?? []
// A table of contents with the page title alone has nothing to navigate
@@ -7,3 +8,4 @@ const hasContents = !(title?.children.length === 0 && headings.length === 0)
---
{hasContents ? : }
+
diff --git a/website/src/components/Sidebar.astro b/website/src/components/Sidebar.astro
deleted file mode 100644
index 7eac416e3..000000000
--- a/website/src/components/Sidebar.astro
+++ /dev/null
@@ -1,27 +0,0 @@
----
-import Default from '@astrojs/starlight/components/Sidebar.astro'
----
-
-
-
-
-
-
diff --git a/website/src/styles/global.css b/website/src/styles/global.css
index 68f2b4dc1..d85df8873 100644
--- a/website/src/styles/global.css
+++ b/website/src/styles/global.css
@@ -11,8 +11,39 @@
--sl-color-accent-high: #1f1d5c;
}
-.rc2-ad {
- margin-top: 1.5rem;
+/* The ad sits at the bottom of the right sidebar, under the table of contents */
+@media (min-width: 72rem) {
+ .right-sidebar {
+ display: flex;
+ flex-direction: column;
+ }
+
+ /* The right sidebar is as wide as the screen: the column is at least as wide as a sidebar */
+ .rc2-bwndw-aside {
+ max-width: var(--sl-sidebar-width);
+ margin-top: auto;
+ padding-block: 1rem;
+ }
+}
+
+/* Without the right sidebar, the ad follows the text of the page */
+.rc2-bwndw-main {
+ max-width: var(--sl-sidebar-width);
+ margin: 2rem auto 0;
+}
+
+/* The ad already sets the footer apart from the text */
+.rc2-bwndw-main ~ footer .meta {
+ margin-top: 1rem;
+}
+
+/* A long table of contents scrolls by itself, so the ad stays in view */
+@media (min-width: 72rem) and (min-height: 40rem) {
+ .right-sidebar-panel {
+ min-height: 0;
+ overflow-y: auto;
+ scrollbar-width: none;
+ }
}
/* No bar for a table of contents that is not shown */
From a5c9631716fc1a22dc0f0dca494e65eefa83d215 Mon Sep 17 00:00:00 2001
From: dangreen
Date: Tue, 1 Dec 2026 01:04:48 +0400
Subject: [PATCH 03/10] docs: keep the previous and next links within a section
The old website had a sidebar per section, and its previous and next links stayed inside the section. The first page of a section links back to the section by its name instead of an ambiguous "Overview", and the long questions of the FAQ fit the links in a smaller font.
---
website/src/content/docs/components/bubble.mdx | 1 +
website/src/content/docs/components/chart.mdx | 1 +
website/src/content/docs/components/index.md | 1 +
website/src/content/docs/docs/chartjs-v2.mdx | 1 +
website/src/content/docs/examples/gradient-chart.mdx | 1 +
website/src/content/docs/examples/index.md | 1 +
website/src/content/docs/examples/vertical-bar-chart.mdx | 1 +
website/src/content/docs/faq/index.md | 1 +
website/src/content/docs/faq/maintain-aspect-ratio.md | 1 +
website/src/styles/global.css | 5 +++++
10 files changed, 14 insertions(+)
diff --git a/website/src/content/docs/components/bubble.mdx b/website/src/content/docs/components/bubble.mdx
index 7f57c0b85..e4685764c 100644
--- a/website/src/content/docs/components/bubble.mdx
+++ b/website/src/content/docs/components/bubble.mdx
@@ -1,6 +1,7 @@
---
title: "Bubble"
description: "Description of Bubble component from react-chartjs-2."
+next: false
---
import PropsTable from '../../../components/PropsTable.astro'
diff --git a/website/src/content/docs/components/chart.mdx b/website/src/content/docs/components/chart.mdx
index ca17b8245..aaef14878 100644
--- a/website/src/content/docs/components/chart.mdx
+++ b/website/src/content/docs/components/chart.mdx
@@ -1,6 +1,7 @@
---
title: "Chart"
description: "Description of Chart component from react-chartjs-2."
+prev: Components
---
import PropsTable from '../../../components/PropsTable.astro'
diff --git a/website/src/content/docs/components/index.md b/website/src/content/docs/components/index.md
index 21bc9b32b..9d57111a9 100644
--- a/website/src/content/docs/components/index.md
+++ b/website/src/content/docs/components/index.md
@@ -1,6 +1,7 @@
---
title: "Components"
description: "List of react-chartjs-2 components."
+prev: false
---
Every component renders a `
From dd508bebafd98e11c96f071b790c87bea0d0e0ca Mon Sep 17 00:00:00 2001
From: dangreen
Date: Tue, 1 Dec 2026 01:04:51 +0400
Subject: [PATCH 05/10] docs: show the Chart type of the ref prop
The props of the components showed ChartJSOrUndefined, an alias of the sources that the package does not export.
---
website/src/components/PropsTable.astro | 1 +
1 file changed, 1 insertion(+)
diff --git a/website/src/components/PropsTable.astro b/website/src/components/PropsTable.astro
index ddc3f97a0..614553bd9 100644
--- a/website/src/components/PropsTable.astro
+++ b/website/src/components/PropsTable.astro
@@ -46,6 +46,7 @@ if (!doc) {
function formatType(type: string) {
return type
.replace(/ \| undefined$/, '')
+ .replace(/ChartJSOrUndefined<([^>]+)>/, 'Chart<$1>')
.replace(/^_DeepPartialObject]+)>[\s\S]*$/, 'ChartOptions<$1>')
}
From 3b9af9b848ebda8e22f644b9744066cbdc375289 Mon Sep 17 00:00:00 2001
From: dangreen
Date: Tue, 1 Dec 2026 01:04:52 +0400
Subject: [PATCH 06/10] docs: fix the texts carried over from the old website
Smartypants turned the quotes of error messages into curly ones, with a closing quote before "... is not a registered element". The FAQ list names a question as its page does, the Chart Ref example gets its old title back, the tree-shaking link of the home page stays on the site it is opened from, and the guides for old Chart.js versions lose their typos.
---
website/astro.config.js | 2 ++
website/src/content/docs/docs/chartjs-v2.mdx | 4 ++--
website/src/content/docs/docs/chartjs-v3.mdx | 4 ++--
website/src/content/docs/examples/chart-ref.mdx | 4 +++-
website/src/content/docs/faq/index.md | 2 +-
website/src/content/docs/index.mdx | 2 +-
6 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/website/astro.config.js b/website/astro.config.js
index c6cae5330..8e9c3b665 100644
--- a/website/astro.config.js
+++ b/website/astro.config.js
@@ -26,6 +26,8 @@ export default defineConfig({
trailingSlash: 'always',
markdown: {
processor: unified({
+ // Docusaurus kept straight quotes and dots, and error messages are quoted as they are
+ smartypants: false,
rehypePlugins: [rehypeTrailingSlash, rehypeExternalLinks]
})
},
diff --git a/website/src/content/docs/docs/chartjs-v2.mdx b/website/src/content/docs/docs/chartjs-v2.mdx
index 127ccdbd9..e0ec5bc69 100644
--- a/website/src/content/docs/docs/chartjs-v2.mdx
+++ b/website/src/content/docs/docs/chartjs-v2.mdx
@@ -36,7 +36,7 @@ Also, please consider upgrading your app to [Chart.js v3](#upgrading-to-chartjs-
## Upgrading to Chart.js v3
-First, upgrade packages. You'll need to install Chart.js v3 and the latest version of this library:
+First, upgrade packages. You'll need to install Chart.js v3 and a compatible version of this library:
@@ -62,4 +62,4 @@ First, upgrade packages. You'll need to install Chart.js v3 and the latest versi
-Then, please follow the [this guide](/docs/migration-to-v4).
+Then, please follow [this guide](/docs/migration-to-v4).
diff --git a/website/src/content/docs/docs/chartjs-v3.mdx b/website/src/content/docs/docs/chartjs-v3.mdx
index f3790f30e..a3ad7b02a 100644
--- a/website/src/content/docs/docs/chartjs-v3.mdx
+++ b/website/src/content/docs/docs/chartjs-v3.mdx
@@ -35,7 +35,7 @@ Also, please consider upgrading your app to [Chart.js v4](#upgrading-to-chartjs-
## Upgrading to Chart.js v4
-First, upgrade packages. You'll need to install Chart.js v3 and the latest version of this library:
+First, upgrade packages. You'll need to install Chart.js v4 and a compatible version of this library:
@@ -61,4 +61,4 @@ First, upgrade packages. You'll need to install Chart.js v3 and the latest versi
-Then, please follow the [this guide](/docs/migration-to-v5).
+Then, please follow [this guide](/docs/migration-to-v5).
diff --git a/website/src/content/docs/examples/chart-ref.mdx b/website/src/content/docs/examples/chart-ref.mdx
index 7bdef4357..19f6dde63 100644
--- a/website/src/content/docs/examples/chart-ref.mdx
+++ b/website/src/content/docs/examples/chart-ref.mdx
@@ -1,5 +1,7 @@
---
-title: "Chart Ref"
+title: "Get Chart Ref"
+sidebar:
+ label: "Chart Ref"
description: "Example of getting ref in react-chartjs-2."
---
diff --git a/website/src/content/docs/faq/index.md b/website/src/content/docs/faq/index.md
index 84f8a1989..3056e693c 100644
--- a/website/src/content/docs/faq/index.md
+++ b/website/src/content/docs/faq/index.md
@@ -9,7 +9,7 @@ Answers to the questions that come up most often.
- [Why doesn't the chart maintain its width/height?](/faq/maintain-aspect-ratio/)
- [How to access the Chart.js instance?](/faq/chartjs-instance/)
- [How to access the canvas context?](/faq/canvas-context/)
-- [Why this library has "2" in its name?](/faq/why-two/)
+- [Why does react-chartjs-2 have "2" in its name?](/faq/why-two/)
- [Why is a background fill not working?](/faq/fill-property/)
- [How to fix "... is not a registered element" error?](/faq/registered-element/)
- [How to fix "... is not a registered scale" error?](/faq/registered-scale/)
diff --git a/website/src/content/docs/index.mdx b/website/src/content/docs/index.mdx
index 340e22aff..ad3886d5b 100644
--- a/website/src/content/docs/index.mdx
+++ b/website/src/content/docs/index.mdx
@@ -78,7 +78,7 @@ ChartJS.register(ArcElement, Tooltip, Legend);
```
-To learn more about importing and registering elements see [tree-shaking](https://react-chartjs-2.js.org/docs/migration-to-v4/#tree-shaking).
+To learn more about importing and registering elements see [tree-shaking](/docs/migration-to-v4/#tree-shaking).
## Examples
From ec40ec1eea9b22cd6100f35b4920bf557d9e96cd Mon Sep 17 00:00:00 2001
From: dangreen
Date: Tue, 1 Dec 2026 01:04:54 +0400
Subject: [PATCH 07/10] docs: link the examples to their components
The tags of the old website led from an example to the page of its component.
---
website/src/content/docs/examples/area-chart.mdx | 2 +-
website/src/content/docs/examples/bubble-chart.mdx | 2 +-
website/src/content/docs/examples/chart-events.mdx | 2 +-
website/src/content/docs/examples/chart-ref.mdx | 2 +-
website/src/content/docs/examples/doughnut-chart.mdx | 2 +-
website/src/content/docs/examples/gradient-chart.mdx | 2 +-
website/src/content/docs/examples/grouped-bar-chart.mdx | 2 +-
website/src/content/docs/examples/horizontal-bar-chart.mdx | 2 +-
website/src/content/docs/examples/line-chart.mdx | 2 +-
website/src/content/docs/examples/multiaxis-line-chart.mdx | 2 +-
website/src/content/docs/examples/multitype-chart.mdx | 2 +-
website/src/content/docs/examples/pie-chart.mdx | 2 +-
website/src/content/docs/examples/polar-area-chart.mdx | 2 +-
website/src/content/docs/examples/radar-chart.mdx | 2 +-
website/src/content/docs/examples/scatter-chart.mdx | 2 +-
website/src/content/docs/examples/stacked-bar-chart.mdx | 2 +-
website/src/content/docs/examples/vertical-bar-chart.mdx | 2 +-
17 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/website/src/content/docs/examples/area-chart.mdx b/website/src/content/docs/examples/area-chart.mdx
index 93f667f59..be91a13e5 100644
--- a/website/src/content/docs/examples/area-chart.mdx
+++ b/website/src/content/docs/examples/area-chart.mdx
@@ -5,6 +5,6 @@ description: "Example of area chart in react-chartjs-2."
import Example from '../../../components/Example.astro'
-Example of area chart in react-chartjs-2.
+Example of area chart with the [``](/components/line/) component.
diff --git a/website/src/content/docs/examples/bubble-chart.mdx b/website/src/content/docs/examples/bubble-chart.mdx
index dd13d7486..63be582e4 100644
--- a/website/src/content/docs/examples/bubble-chart.mdx
+++ b/website/src/content/docs/examples/bubble-chart.mdx
@@ -5,6 +5,6 @@ description: "Example of bubble chart in react-chartjs-2."
import Example from '../../../components/Example.astro'
-Example of bubble chart in react-chartjs-2.
+Example of bubble chart with the [``](/components/bubble/) component.
diff --git a/website/src/content/docs/examples/chart-events.mdx b/website/src/content/docs/examples/chart-events.mdx
index d87c022cd..dc9950595 100644
--- a/website/src/content/docs/examples/chart-events.mdx
+++ b/website/src/content/docs/examples/chart-events.mdx
@@ -5,6 +5,6 @@ description: "Example of events in react-chartjs-2."
import Example from '../../../components/Example.astro'
-Example of events in react-chartjs-2.
+Example of events with the [``](/components/chart/) component.
diff --git a/website/src/content/docs/examples/chart-ref.mdx b/website/src/content/docs/examples/chart-ref.mdx
index 19f6dde63..c4fe07b0a 100644
--- a/website/src/content/docs/examples/chart-ref.mdx
+++ b/website/src/content/docs/examples/chart-ref.mdx
@@ -7,6 +7,6 @@ description: "Example of getting ref in react-chartjs-2."
import Example from '../../../components/Example.astro'
-Example of getting ref in react-chartjs-2.
+Example of getting ref with the [``](/components/chart/) component.
diff --git a/website/src/content/docs/examples/doughnut-chart.mdx b/website/src/content/docs/examples/doughnut-chart.mdx
index 5dd08af3a..4db2cd4fd 100644
--- a/website/src/content/docs/examples/doughnut-chart.mdx
+++ b/website/src/content/docs/examples/doughnut-chart.mdx
@@ -5,6 +5,6 @@ description: "Example of doughnut chart in react-chartjs-2."
import Example from '../../../components/Example.astro'
-Example of doughnut chart in react-chartjs-2.
+Example of doughnut chart with the [``](/components/doughnut/) component.
diff --git a/website/src/content/docs/examples/gradient-chart.mdx b/website/src/content/docs/examples/gradient-chart.mdx
index 479c2a046..75b6a6691 100644
--- a/website/src/content/docs/examples/gradient-chart.mdx
+++ b/website/src/content/docs/examples/gradient-chart.mdx
@@ -6,6 +6,6 @@ next: false
import Example from '../../../components/Example.astro'
-Example of creating gradient chart in react-chartjs-2.
+Example of creating gradient chart with the [``](/components/chart/) component.
diff --git a/website/src/content/docs/examples/grouped-bar-chart.mdx b/website/src/content/docs/examples/grouped-bar-chart.mdx
index 3c8c5141c..7fae037aa 100644
--- a/website/src/content/docs/examples/grouped-bar-chart.mdx
+++ b/website/src/content/docs/examples/grouped-bar-chart.mdx
@@ -5,6 +5,6 @@ description: "Example of grouped bar chart in react-chartjs-2."
import Example from '../../../components/Example.astro'
-Example of grouped bar chart in react-chartjs-2.
+Example of grouped bar chart with the [``](/components/bar/) component.
diff --git a/website/src/content/docs/examples/horizontal-bar-chart.mdx b/website/src/content/docs/examples/horizontal-bar-chart.mdx
index e1e532f52..aa0cd8893 100644
--- a/website/src/content/docs/examples/horizontal-bar-chart.mdx
+++ b/website/src/content/docs/examples/horizontal-bar-chart.mdx
@@ -5,6 +5,6 @@ description: "Example of horizontal bar chart in react-chartjs-2."
import Example from '../../../components/Example.astro'
-Example of horizontal bar chart in react-chartjs-2.
+Example of horizontal bar chart with the [``](/components/bar/) component.
diff --git a/website/src/content/docs/examples/line-chart.mdx b/website/src/content/docs/examples/line-chart.mdx
index 2f597af2f..17f4c241b 100644
--- a/website/src/content/docs/examples/line-chart.mdx
+++ b/website/src/content/docs/examples/line-chart.mdx
@@ -5,6 +5,6 @@ description: "Example of line chart in react-chartjs-2."
import Example from '../../../components/Example.astro'
-Example of line chart in react-chartjs-2.
+Example of line chart with the [``](/components/line/) component.
diff --git a/website/src/content/docs/examples/multiaxis-line-chart.mdx b/website/src/content/docs/examples/multiaxis-line-chart.mdx
index d34ac9f96..5430a0d3a 100644
--- a/website/src/content/docs/examples/multiaxis-line-chart.mdx
+++ b/website/src/content/docs/examples/multiaxis-line-chart.mdx
@@ -5,6 +5,6 @@ description: "Example of multiaxis line chart in react-chartjs-2."
import Example from '../../../components/Example.astro'
-Example of multiaxis line chart in react-chartjs-2.
+Example of multiaxis line chart with the [``](/components/line/) component.
diff --git a/website/src/content/docs/examples/multitype-chart.mdx b/website/src/content/docs/examples/multitype-chart.mdx
index 4b44ef3bc..09214bac2 100644
--- a/website/src/content/docs/examples/multitype-chart.mdx
+++ b/website/src/content/docs/examples/multitype-chart.mdx
@@ -5,6 +5,6 @@ description: "Example of multitype chart in react-chartjs-2."
import Example from '../../../components/Example.astro'
-Example of multitype chart in react-chartjs-2.
+Example of multitype chart with the [``](/components/chart/) component.
diff --git a/website/src/content/docs/examples/pie-chart.mdx b/website/src/content/docs/examples/pie-chart.mdx
index da2fd1b19..6339f6f1d 100644
--- a/website/src/content/docs/examples/pie-chart.mdx
+++ b/website/src/content/docs/examples/pie-chart.mdx
@@ -5,6 +5,6 @@ description: "Example of pie chart in react-chartjs-2."
import Example from '../../../components/Example.astro'
-Example of pie chart in react-chartjs-2.
+Example of pie chart with the [``](/components/pie/) component.
diff --git a/website/src/content/docs/examples/polar-area-chart.mdx b/website/src/content/docs/examples/polar-area-chart.mdx
index c3e4ed3a2..8b0a9ee10 100644
--- a/website/src/content/docs/examples/polar-area-chart.mdx
+++ b/website/src/content/docs/examples/polar-area-chart.mdx
@@ -5,6 +5,6 @@ description: "Example of polar area chart in react-chartjs-2."
import Example from '../../../components/Example.astro'
-Example of polar area chart in react-chartjs-2.
+Example of polar area chart with the [``](/components/polar-area/) component.
diff --git a/website/src/content/docs/examples/radar-chart.mdx b/website/src/content/docs/examples/radar-chart.mdx
index 1dd64bc50..ed581a2eb 100644
--- a/website/src/content/docs/examples/radar-chart.mdx
+++ b/website/src/content/docs/examples/radar-chart.mdx
@@ -5,6 +5,6 @@ description: "Example of radar chart in react-chartjs-2."
import Example from '../../../components/Example.astro'
-Example of radar chart in react-chartjs-2.
+Example of radar chart with the [``](/components/radar/) component.
diff --git a/website/src/content/docs/examples/scatter-chart.mdx b/website/src/content/docs/examples/scatter-chart.mdx
index 75079cfb5..a5b2aa647 100644
--- a/website/src/content/docs/examples/scatter-chart.mdx
+++ b/website/src/content/docs/examples/scatter-chart.mdx
@@ -5,6 +5,6 @@ description: "Example of scatter chart in react-chartjs-2."
import Example from '../../../components/Example.astro'
-Example of scatter chart in react-chartjs-2.
+Example of scatter chart with the [``](/components/scatter/) component.
diff --git a/website/src/content/docs/examples/stacked-bar-chart.mdx b/website/src/content/docs/examples/stacked-bar-chart.mdx
index 144f4bc21..0771c5194 100644
--- a/website/src/content/docs/examples/stacked-bar-chart.mdx
+++ b/website/src/content/docs/examples/stacked-bar-chart.mdx
@@ -5,6 +5,6 @@ description: "Example of stacked bar chart in react-chartjs-2."
import Example from '../../../components/Example.astro'
-Example of stacked bar chart in react-chartjs-2.
+Example of stacked bar chart with the [``](/components/bar/) component.
diff --git a/website/src/content/docs/examples/vertical-bar-chart.mdx b/website/src/content/docs/examples/vertical-bar-chart.mdx
index 045aafb6c..e04a128e7 100644
--- a/website/src/content/docs/examples/vertical-bar-chart.mdx
+++ b/website/src/content/docs/examples/vertical-bar-chart.mdx
@@ -6,6 +6,6 @@ prev: Examples
import Example from '../../../components/Example.astro'
-Example of vertical bar chart in react-chartjs-2.
+Example of vertical bar chart with the [``](/components/bar/) component.
From b128fa7e4c4c6f8c0f364ad4f48573a58fe0318a Mon Sep 17 00:00:00 2001
From: dangreen
Date: Tue, 1 Dec 2026 01:04:54 +0400
Subject: [PATCH 08/10] docs: link GitHub Discussions from the header and the
FAQ
The header of the old website linked the questions on Stack Overflow.
---
website/astro.config.js | 5 +++++
website/src/content/docs/faq/index.md | 2 ++
2 files changed, 7 insertions(+)
diff --git a/website/astro.config.js b/website/astro.config.js
index 8e9c3b665..786667eae 100644
--- a/website/astro.config.js
+++ b/website/astro.config.js
@@ -73,6 +73,11 @@ export default defineConfig({
label: 'GitHub',
icon: 'github',
href: 'https://github.com/reactchartjs/react-chartjs-2'
+ },
+ {
+ label: 'Questions in GitHub Discussions',
+ icon: 'comment-alt',
+ href: 'https://github.com/reactchartjs/react-chartjs-2/discussions/categories/q-a'
}
],
editLink: {
diff --git a/website/src/content/docs/faq/index.md b/website/src/content/docs/faq/index.md
index 3056e693c..dbb4685cf 100644
--- a/website/src/content/docs/faq/index.md
+++ b/website/src/content/docs/faq/index.md
@@ -15,3 +15,5 @@ Answers to the questions that come up most often.
- [How to fix "... is not a registered scale" error?](/faq/registered-scale/)
- [How to use react-chartjs-2 with TypeScript?](/faq/typescript/)
- [How to fix "Cannot find module 'react-chartjs-2'" error?](/faq/esm-only/)
+
+Did not find the answer? [Ask a question in GitHub Discussions](https://github.com/reactchartjs/react-chartjs-2/discussions/categories/q-a).
From 43b7b53cfb1e0b07d89863e3a80a090f26512ee5 Mon Sep 17 00:00:00 2001
From: dangreen
Date: Tue, 1 Dec 2026 01:04:56 +0400
Subject: [PATCH 09/10] docs: put a gap between an example and its intro
The custom element of the example was inline, so the margin of content blocks did not apply and the tabs stuck to the intro.
---
website/src/styles/global.css | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/website/src/styles/global.css b/website/src/styles/global.css
index fcb8d0252..0c94148db 100644
--- a/website/src/styles/global.css
+++ b/website/src/styles/global.css
@@ -81,6 +81,11 @@
display: block;
}
+/* A block, so the example gets the gap above it like other content */
+rc2-example {
+ display: block;
+}
+
.rc2-example-frame {
width: 100%;
height: 500px;
From 6f3cf24dcf828632b25c1c595eb64dc3515fe4b4 Mon Sep 17 00:00:00 2001
From: dangreen
Date: Tue, 1 Dec 2026 01:04:57 +0400
Subject: [PATCH 10/10] docs: serve the previews of the examples in the dev
server
Unlike GitHub Pages, Vite does not answer a directory of public with its index.html, so every preview showed a 404 page in development.
---
website/astro.config.js | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/website/astro.config.js b/website/astro.config.js
index 786667eae..1a5ff23ab 100644
--- a/website/astro.config.js
+++ b/website/astro.config.js
@@ -31,6 +31,25 @@ export default defineConfig({
rehypePlugins: [rehypeTrailingSlash, rehypeExternalLinks]
})
},
+ vite: {
+ plugins: [
+ {
+ name: 'sandbox-index',
+ // Unlike GitHub Pages, the dev server does not answer a directory of `public` with its index.html
+ configureServer(server) {
+ server.middlewares.use((req, _res, next) => {
+ const [path, query] = (req.url ?? '').split('?')
+
+ if (path.startsWith('/sandboxes/') && path.endsWith('/')) {
+ req.url = `${path}index.html${query === undefined ? '' : `?${query}`}`
+ }
+
+ next()
+ })
+ }
+ }
+ ]
+ },
// Pages of the Docusaurus website that have no counterpart
redirects: {
'/search': '/',