@acronis-platform/ui-react 3.0.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ui/accordion-container/accordion-container.js +14 -14
- package/dist/components/ui/accordion-container/accordion-container.js.map +1 -1
- package/dist/components/ui/app-shell-chat/app-shell-chat.js.map +1 -1
- package/dist/components/ui/area-chart/area-chart.js +141 -139
- package/dist/components/ui/area-chart/area-chart.js.map +1 -1
- package/dist/components/ui/bar-chart/bar-chart.js +295 -293
- package/dist/components/ui/bar-chart/bar-chart.js.map +1 -1
- package/dist/components/ui/category-bar/category-bar.js +109 -93
- package/dist/components/ui/category-bar/category-bar.js.map +1 -1
- package/dist/components/ui/chart/chart-palette.js +113 -0
- package/dist/components/ui/chart/chart-palette.js.map +1 -0
- package/dist/components/ui/chart/chart.js +176 -129
- package/dist/components/ui/chart/chart.js.map +1 -1
- package/dist/components/ui/chart-state/chart-state-illustrations.js +310 -0
- package/dist/components/ui/chart-state/chart-state-illustrations.js.map +1 -0
- package/dist/components/ui/chart-state/chart-state.js +48 -34
- package/dist/components/ui/chart-state/chart-state.js.map +1 -1
- package/dist/components/ui/chart-widget/chart-widget.js +87 -0
- package/dist/components/ui/chart-widget/chart-widget.js.map +1 -0
- package/dist/components/ui/composed-chart/composed-chart.js +117 -115
- package/dist/components/ui/composed-chart/composed-chart.js.map +1 -1
- package/dist/components/ui/confidence-cone/confidence-cone.js +166 -158
- package/dist/components/ui/confidence-cone/confidence-cone.js.map +1 -1
- package/dist/components/ui/funnel-chart/funnel-chart.js +162 -161
- package/dist/components/ui/funnel-chart/funnel-chart.js.map +1 -1
- package/dist/components/ui/histogram/histogram.js +94 -92
- package/dist/components/ui/histogram/histogram.js.map +1 -1
- package/dist/components/ui/input/input.js.map +1 -1
- package/dist/components/ui/label/label.js +2 -9
- package/dist/components/ui/label/label.js.map +1 -1
- package/dist/components/ui/line-chart/line-chart.js +143 -141
- package/dist/components/ui/line-chart/line-chart.js.map +1 -1
- package/dist/components/ui/metric/metric.js +74 -185
- package/dist/components/ui/metric/metric.js.map +1 -1
- package/dist/components/ui/page-content/page-content.js.map +1 -1
- package/dist/components/ui/pie-chart/pie-chart.js +201 -195
- package/dist/components/ui/pie-chart/pie-chart.js.map +1 -1
- package/dist/components/ui/radar-chart/radar-chart.js +133 -131
- package/dist/components/ui/radar-chart/radar-chart.js.map +1 -1
- package/dist/components/ui/radial-bar-chart/radial-bar-chart.js +297 -265
- package/dist/components/ui/radial-bar-chart/radial-bar-chart.js.map +1 -1
- package/dist/components/ui/sankey-chart/sankey-chart.js +123 -101
- package/dist/components/ui/sankey-chart/sankey-chart.js.map +1 -1
- package/dist/components/ui/scatter-chart/scatter-chart.js +76 -74
- package/dist/components/ui/scatter-chart/scatter-chart.js.map +1 -1
- package/dist/components/ui/section/section.js +157 -31
- package/dist/components/ui/section/section.js.map +1 -1
- package/dist/components/ui/stepper/stepper.js +24 -24
- package/dist/components/ui/stepper/stepper.js.map +1 -1
- package/dist/components/ui/stepper-item/stepper-item.js +43 -24
- package/dist/components/ui/stepper-item/stepper-item.js.map +1 -1
- package/dist/components/ui/treemap/treemap.js +133 -124
- package/dist/components/ui/treemap/treemap.js.map +1 -1
- package/dist/components/ui/trend-indicator/trend-indicator.js +34 -69
- package/dist/components/ui/trend-indicator/trend-indicator.js.map +1 -1
- package/dist/components/ui/wizard/wizard.js +59 -0
- package/dist/components/ui/wizard/wizard.js.map +1 -0
- package/dist/hooks/use-wizard.js +75 -0
- package/dist/hooks/use-wizard.js.map +1 -0
- package/dist/index.js +502 -497
- package/dist/index.js.map +1 -1
- package/dist/llms/accordion-container.md +181 -0
- package/dist/llms/accordion.md +124 -0
- package/dist/llms/alert.md +225 -0
- package/dist/llms/app-shell-chat.md +415 -0
- package/dist/llms/area-chart.md +355 -0
- package/dist/llms/avatar.md +208 -0
- package/dist/llms/bar-chart.md +406 -0
- package/dist/llms/breadcrumb.md +326 -0
- package/dist/llms/button-group.md +298 -0
- package/dist/llms/button-icon-input.md +142 -0
- package/dist/llms/button-icon-menu.md +209 -0
- package/dist/llms/button-icon.md +128 -0
- package/dist/llms/button-menu.md +172 -0
- package/dist/llms/button.md +185 -0
- package/dist/llms/calendar-panel.md +733 -0
- package/dist/llms/calendar.md +188 -0
- package/dist/llms/card-filter.md +214 -0
- package/dist/llms/card-section.md +293 -0
- package/dist/llms/card.md +447 -0
- package/dist/llms/carousel-dialog.md +156 -0
- package/dist/llms/category-bar.md +193 -0
- package/dist/llms/chart-state.md +190 -0
- package/dist/llms/chart-widget.md +209 -0
- package/dist/llms/chart.md +182 -0
- package/dist/llms/checkbox.md +257 -0
- package/dist/llms/chip.md +195 -0
- package/dist/llms/combobox.md +164 -0
- package/dist/llms/composed-chart.md +508 -0
- package/dist/llms/confidence-cone.md +277 -0
- package/dist/llms/data-table.md +474 -0
- package/dist/llms/date-range-picker.md +272 -0
- package/dist/llms/description-list.md +131 -0
- package/dist/llms/dialog-footer-carousel.md +147 -0
- package/dist/llms/dialog-footer-default.md +142 -0
- package/dist/llms/dialog-root.md +246 -0
- package/dist/llms/dialog-welcome.md +223 -0
- package/dist/llms/dialog.md +403 -0
- package/dist/llms/dropdown-menu.md +193 -0
- package/dist/llms/empty-overlay.md +146 -0
- package/dist/llms/empty.md +156 -0
- package/dist/llms/field.md +185 -0
- package/dist/llms/filter-cards.md +157 -0
- package/dist/llms/filter-chips.md +323 -0
- package/dist/llms/filter-search.md +512 -0
- package/dist/llms/form.md +154 -0
- package/dist/llms/funnel-chart.md +333 -0
- package/dist/llms/grid.md +80 -0
- package/dist/llms/histogram.md +190 -0
- package/dist/llms/input-date-picker.md +203 -0
- package/dist/llms/input-otp.md +173 -0
- package/dist/llms/input-password.md +197 -0
- package/dist/llms/input-search.md +170 -0
- package/dist/llms/input-select.md +278 -0
- package/dist/llms/input-text-area.md +271 -0
- package/dist/llms/input-text.md +192 -0
- package/dist/llms/line-chart.md +369 -0
- package/dist/llms/link.md +209 -0
- package/dist/llms/loading.md +130 -0
- package/dist/llms/meter.md +177 -0
- package/dist/llms/metric.md +204 -0
- package/dist/llms/number-field.md +122 -0
- package/dist/llms/page-content.md +69 -0
- package/dist/llms/page-header.md +182 -0
- package/dist/llms/pagination.md +133 -0
- package/dist/llms/pie-chart.md +307 -0
- package/dist/llms/popover.md +252 -0
- package/dist/llms/progress-circle.md +126 -0
- package/dist/llms/progress.md +111 -0
- package/dist/llms/radar-chart.md +316 -0
- package/dist/llms/radial-bar-chart.md +319 -0
- package/dist/llms/radio.md +255 -0
- package/dist/llms/resizable.md +195 -0
- package/dist/llms/sankey-chart.md +208 -0
- package/dist/llms/scatter-chart.md +239 -0
- package/dist/llms/scroll-area.md +183 -0
- package/dist/llms/section.md +401 -0
- package/dist/llms/select.md +210 -0
- package/dist/llms/separator.md +87 -0
- package/dist/llms/sheet.md +202 -0
- package/dist/llms/sidebar-primary.md +360 -0
- package/dist/llms/sidebar-secondary.md +417 -0
- package/dist/llms/skeleton.md +81 -0
- package/dist/llms/slider.md +97 -0
- package/dist/llms/spinner.md +100 -0
- package/dist/llms/stack.md +80 -0
- package/dist/llms/stepper-item.md +309 -0
- package/dist/llms/stepper.md +251 -0
- package/dist/llms/switch.md +140 -0
- package/dist/llms/table.md +436 -0
- package/dist/llms/tabs.md +197 -0
- package/dist/llms/tag.md +139 -0
- package/dist/llms/timeline.md +361 -0
- package/dist/llms/timer.md +259 -0
- package/dist/llms/toast.md +241 -0
- package/dist/llms/toggle-group.md +121 -0
- package/dist/llms/toolbar.md +453 -0
- package/dist/llms/tooltip.md +164 -0
- package/dist/llms/treemap.md +254 -0
- package/dist/llms/trend-indicator.md +132 -0
- package/dist/llms/widget-placeholder.md +169 -0
- package/dist/llms/wizard.md +412 -0
- package/dist/llms.txt +142 -0
- package/dist/react.js +502 -497
- package/dist/react.js.map +1 -1
- package/dist/src/components/ui/area-chart/area-chart.d.ts +9 -4
- package/dist/src/components/ui/avatar/avatar.d.ts +1 -1
- package/dist/src/components/ui/bar-chart/bar-chart.d.ts +9 -4
- package/dist/src/components/ui/category-bar/category-bar.d.ts +10 -4
- package/dist/src/components/ui/chart/__stories__/palette-control.d.ts +48 -0
- package/dist/src/components/ui/chart/__tests__/chart-palette.test.d.ts +1 -0
- package/dist/src/components/ui/chart/chart-palette.d.ts +128 -0
- package/dist/src/components/ui/chart/chart.d.ts +66 -15
- package/dist/src/components/ui/chart/index.d.ts +4 -2
- package/dist/src/components/ui/chart-state/chart-state-illustrations.d.ts +6 -0
- package/dist/src/components/ui/chart-state/chart-state.d.ts +13 -2
- package/dist/src/components/ui/chart-state/index.d.ts +1 -0
- package/dist/src/components/ui/chart-widget/chart-widget.d.ts +64 -0
- package/dist/src/components/ui/chart-widget/index.d.ts +1 -0
- package/dist/src/components/ui/composed-chart/composed-chart.d.ts +12 -7
- package/dist/src/components/ui/confidence-cone/confidence-cone.d.ts +10 -5
- package/dist/src/components/ui/empty-overlay/empty-overlay.d.ts +1 -1
- package/dist/src/components/ui/funnel-chart/funnel-chart.d.ts +11 -5
- package/dist/src/components/ui/histogram/histogram.d.ts +10 -4
- package/dist/src/components/ui/label/index.d.ts +1 -1
- package/dist/src/components/ui/label/label.d.ts +1 -5
- package/dist/src/components/ui/line-chart/line-chart.d.ts +9 -4
- package/dist/src/components/ui/metric/metric.d.ts +13 -14
- package/dist/src/components/ui/pie-chart/pie-chart.d.ts +17 -8
- package/dist/src/components/ui/radar-chart/radar-chart.d.ts +10 -5
- package/dist/src/components/ui/radial-bar-chart/radial-bar-chart.d.ts +17 -6
- package/dist/src/components/ui/sankey-chart/sankey-chart.d.ts +10 -5
- package/dist/src/components/ui/scatter-chart/scatter-chart.d.ts +10 -5
- package/dist/src/components/ui/section/index.d.ts +1 -1
- package/dist/src/components/ui/section/section.d.ts +75 -6
- package/dist/src/components/ui/stepper-item/stepper-item.d.ts +6 -5
- package/dist/src/components/ui/tag/tag.d.ts +1 -1
- package/dist/src/components/ui/treemap/treemap.d.ts +11 -5
- package/dist/src/components/ui/trend-indicator/trend-indicator.d.ts +3 -7
- package/dist/src/components/ui/wizard/index.d.ts +1 -0
- package/dist/src/components/ui/wizard/wizard.d.ts +6 -0
- package/dist/src/hooks/index.d.ts +1 -0
- package/dist/src/hooks/use-wizard.d.ts +80 -0
- package/dist/src/index.d.ts +2 -3
- package/dist/ui-react.css +1 -1
- package/package.json +9 -3
- package/dist/components/ui/app-shell/app-shell.js +0 -75
- package/dist/components/ui/app-shell/app-shell.js.map +0 -1
- package/dist/components/ui/auth-layout/auth-layout.js +0 -56
- package/dist/components/ui/auth-layout/auth-layout.js.map +0 -1
- package/dist/components/ui/collapsible/collapsible.js +0 -22
- package/dist/components/ui/collapsible/collapsible.js.map +0 -1
- package/dist/src/components/ui/app-shell/app-shell.d.ts +0 -8
- package/dist/src/components/ui/app-shell/index.d.ts +0 -1
- package/dist/src/components/ui/auth-layout/auth-layout.d.ts +0 -6
- package/dist/src/components/ui/auth-layout/index.d.ts +0 -1
- package/dist/src/components/ui/collapsible/collapsible.d.ts +0 -5
- package/dist/src/components/ui/collapsible/index.d.ts +0 -1
- package/dist/src/components/ui/label/label.docs.d.ts +0 -10
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# Progress
|
|
2
|
+
|
|
3
|
+
> A horizontal bar showing the completion of a known-length task, or an indeterminate sliding bar when the length is unknown. Ported from the legacy shadcn-uikit `Progress`; wraps the Base UI Progress primitive.
|
|
4
|
+
|
|
5
|
+
**Status:** draft · **Category:** feedback · **Since:** v0.40.0
|
|
6
|
+
|
|
7
|
+
## Import
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { Progress } from '@acronis-platform/ui-react'
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick example
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
<Progress value={40} />
|
|
17
|
+
<Progress value={null} />
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
A horizontal bar showing the completion of a known-length task, or an
|
|
21
|
+
indeterminate sliding bar when the length is unknown.
|
|
22
|
+
|
|
23
|
+
> **Status: draft (design-pending v1).** Ported from the legacy
|
|
24
|
+
> `@acronis-platform/shadcn-uikit` `Progress`. No `--ui-progress-*` tier yet; the
|
|
25
|
+
> track uses `bg-input` and the indicator the brand blue (`bg-secondary`).
|
|
26
|
+
> Reconcile with `/figma-component Progress <url> --update` once a mockup lands.
|
|
27
|
+
|
|
28
|
+
## When to use
|
|
29
|
+
|
|
30
|
+
- Showing measurable progress of an operation (upload, install, multi-step flow).
|
|
31
|
+
- An indeterminate bar (`value={null}`) for an in-progress operation of unknown
|
|
32
|
+
length.
|
|
33
|
+
|
|
34
|
+
## When not to use
|
|
35
|
+
|
|
36
|
+
- For a small inline busy indicator — use `Loading`.
|
|
37
|
+
- For a status that isn't progress (e.g. a count) — use a different component.
|
|
38
|
+
|
|
39
|
+
## Parts
|
|
40
|
+
|
|
41
|
+
| Part | Element | Purpose |
|
|
42
|
+
| ----------- | ------- | -------------------------------------------------------------- |
|
|
43
|
+
| `root` | div | `role="progressbar"`; owns the ARIA value range. |
|
|
44
|
+
| `track` | div | The full-width rail. |
|
|
45
|
+
| `indicator` | div | The fill; width follows `value`, or slides when indeterminate. |
|
|
46
|
+
|
|
47
|
+
## Example
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
import { Progress } from '@acronis-platform/ui-react';
|
|
51
|
+
|
|
52
|
+
<Progress value={40} />
|
|
53
|
+
<Progress value={null} /> {/* indeterminate */}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Props
|
|
57
|
+
|
|
58
|
+
| Prop | Type | Default | Required | Description |
|
|
59
|
+
|------|------|---------|----------|-------------|
|
|
60
|
+
| `value` | `number | null` | `null` | no | Completion between `min` and `max`. `null` renders an indeterminate sliding bar. |
|
|
61
|
+
| `max` | `number` | `100` | no | The value that represents full completion. |
|
|
62
|
+
| `min` | `number` | `0` | no | The value that represents no completion. |
|
|
63
|
+
|
|
64
|
+
## Behavior
|
|
65
|
+
|
|
66
|
+
Progress shows the completion of a task. State is driven entirely by the `value`
|
|
67
|
+
prop; there is no internal state.
|
|
68
|
+
|
|
69
|
+
```gherkin
|
|
70
|
+
Scenario: Determinate
|
|
71
|
+
Given a Progress with value={40}
|
|
72
|
+
Then the indicator fills 40% of the track
|
|
73
|
+
And aria-valuenow is 40
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
```gherkin
|
|
77
|
+
Scenario: Custom range
|
|
78
|
+
Given a Progress with value={5} and max={10}
|
|
79
|
+
Then the indicator fills 50% of the track
|
|
80
|
+
And aria-valuemax is 10
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
```gherkin
|
|
84
|
+
Scenario: Indeterminate
|
|
85
|
+
Given a Progress with value={null}
|
|
86
|
+
Then a fixed-width indicator slides across the track continuously
|
|
87
|
+
And aria-valuenow is omitted
|
|
88
|
+
And the root carries data-indeterminate
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
```gherkin
|
|
92
|
+
Scenario: Reduced motion
|
|
93
|
+
Given a user with prefers-reduced-motion
|
|
94
|
+
Then the platform honors that preference for the sliding animation
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Accessibility
|
|
98
|
+
|
|
99
|
+
- The root is `role="progressbar"` (provided by Base UI Progress.Root). It
|
|
100
|
+
exposes `aria-valuenow`, `aria-valuemin`, and `aria-valuemax` for determinate
|
|
101
|
+
bars, and omits `aria-valuenow` when indeterminate.
|
|
102
|
+
- Give the bar an accessible name with `aria-label` or `aria-labelledby` (e.g.
|
|
103
|
+
pointing at a nearby Label) so assistive tech announces what is progressing.
|
|
104
|
+
- Use `aria-valuetext` / `getAriaValueText` (forwarded to Base UI) when a
|
|
105
|
+
human-friendly value is clearer than the raw number (e.g. "Step 2 of 5").
|
|
106
|
+
|
|
107
|
+
## Contrast
|
|
108
|
+
|
|
109
|
+
The indicator uses `--ui-background-brand-secondary` (brand blue) over the
|
|
110
|
+
`--ui-border-on-surface-border` track; both meet non-text contrast against the
|
|
111
|
+
page surface in light and dark.
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
# RadarChart
|
|
2
|
+
|
|
3
|
+
> A typed radar-chart composition over the shared `Chart` primitives (the first polar chart type). Plots a set of series `dataKeys` over one shared angular axis (`angleKey`) inside a `ChartContainer`, with a polar grid, tooltip, and legend. One variant axis: `gridType` (the web drawn as straight-edged `polygon` rings or smooth `circle` rings). Ported from the apps/demo `RadarChartPlayground`.
|
|
4
|
+
|
|
5
|
+
**Status:** draft · **Category:** data-display · **Since:** v0.58.0
|
|
6
|
+
|
|
7
|
+
## Import
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { RadarChart } from '@acronis-platform/ui-react'
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick example
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
<RadarChart
|
|
17
|
+
config={config}
|
|
18
|
+
data={data}
|
|
19
|
+
dataKeys={['alice', 'bob']}
|
|
20
|
+
angleKey="subject"
|
|
21
|
+
gridType="polygon"
|
|
22
|
+
className="h-[380px] w-[420px]"
|
|
23
|
+
/>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
A typed radar-chart built on the shared `Chart` primitives. Give it `data`, a
|
|
27
|
+
per-series `config`, the series to plot (`dataKeys`), and the angular axis key
|
|
28
|
+
(`angleKey`); it renders a themed recharts `RadarChart` — polar grid, spoke
|
|
29
|
+
labels, tooltip, and legend included — so you don't hand-compose recharts
|
|
30
|
+
children.
|
|
31
|
+
|
|
32
|
+
Series colors come from the `palette` prop — a dataviz palette resolving to the
|
|
33
|
+
`--ui-dataviz-*` tokens, `categorical` by default — not from `config`.
|
|
34
|
+
|
|
35
|
+
> **Design-pending v1.** Ported from the apps/demo `RadarChartPlayground`. The
|
|
36
|
+
> chrome is reconciled with Figma later; Code Connect is deferred.
|
|
37
|
+
|
|
38
|
+
## When to use
|
|
39
|
+
|
|
40
|
+
- Comparing several entities across the **same set of quantitative axes** (skill
|
|
41
|
+
profiles, product-feature scorecards, test results per subject).
|
|
42
|
+
- A handful of axes (~4–8) and a few series read best.
|
|
43
|
+
|
|
44
|
+
## When not to use
|
|
45
|
+
|
|
46
|
+
- A single series or a single metric — a bar chart compares magnitudes far more
|
|
47
|
+
precisely (radial value judgement is hard).
|
|
48
|
+
- Many series or many axes — the overlapping areas become unreadable.
|
|
49
|
+
- A trend over time — use a line or area chart.
|
|
50
|
+
|
|
51
|
+
## Variants
|
|
52
|
+
|
|
53
|
+
| Axis | Values | Effect |
|
|
54
|
+
| ---------- | -------------------- | -------------------------------------------------------- |
|
|
55
|
+
| `gridType` | `polygon` · `circle` | The web drawn as straight-edged rings vs smooth circles. |
|
|
56
|
+
|
|
57
|
+
## Example
|
|
58
|
+
|
|
59
|
+
```tsx
|
|
60
|
+
import { RadarChart } from '@acronis-platform/ui-react';
|
|
61
|
+
import type { ChartConfig } from '@acronis-platform/ui-react';
|
|
62
|
+
|
|
63
|
+
const data = [
|
|
64
|
+
{ subject: 'Math', alice: 120, bob: 110 },
|
|
65
|
+
{ subject: 'English', alice: 86, bob: 130 },
|
|
66
|
+
{ subject: 'Physics', alice: 85, bob: 90 },
|
|
67
|
+
{ subject: 'History', alice: 65, bob: 85 },
|
|
68
|
+
];
|
|
69
|
+
|
|
70
|
+
const config = {
|
|
71
|
+
alice: { label: 'Alice', color: 'var(--ui-background-brand-secondary)' },
|
|
72
|
+
bob: { label: 'Bob', color: 'var(--ui-background-status-strong-danger)' },
|
|
73
|
+
} satisfies ChartConfig;
|
|
74
|
+
|
|
75
|
+
<RadarChart
|
|
76
|
+
config={config}
|
|
77
|
+
data={data}
|
|
78
|
+
dataKeys={['alice', 'bob']}
|
|
79
|
+
angleKey="subject"
|
|
80
|
+
className="h-[380px] w-[420px]"
|
|
81
|
+
/>;
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Series colors reference existing semantic `--ui-*` tokens. `--ui-background-status-strong-*`
|
|
85
|
+
is chromatic in every brand; `--ui-background-brand-secondary` is brand-dependent
|
|
86
|
+
(blue in `default`, neutral in some white-label brands), so it is not color-stable
|
|
87
|
+
across brands until the real data-viz palette lands.
|
|
88
|
+
|
|
89
|
+
## Props
|
|
90
|
+
|
|
91
|
+
| Prop | Type | Default | Required | Description |
|
|
92
|
+
|------|------|---------|----------|-------------|
|
|
93
|
+
| `gridType` | `'polygon' | 'circle'` | `'polygon'` | no | How the polar grid (web) is drawn. `polygon` = straight-edged rings connecting the spokes; `circle` = smooth concentric rings. |
|
|
94
|
+
| `data` | `ReadonlyArray<Record<string, string | number>>` | — | yes | Row-per-axis data — each row holds `angleKey` plus one numeric field per series. Every plotted series needs a value in every row: a missing one is placed at the centre, which reads as a zero rather than as a gap. |
|
|
95
|
+
| `config` | `ChartConfig` | — | yes | Series take their colour from the container's `palette`; each entry maps a data key to a `label` and an optional `tone`. Resolved into the `--color-<key>` custom properties the areas stroke and fill from. |
|
|
96
|
+
| `dataKeys` | `string[]` | — | yes | Series to plot — one radar area per key. Each must exist in `config` and every data row. |
|
|
97
|
+
| `angleKey` | `string` | — | yes | The categorical axis key placed around the web (the spokes). |
|
|
98
|
+
| `seriesSettings` | `Record<string, RadarChartSeriesSettings>` | — | no | Per-series style overrides keyed by a `dataKeys` entry — `color`, `stroke`, `fillOpacity`, `strokeWidth`, `dot`, `dotRadius`, `activeDot`. Unplotted keys are ignored. An overridden `color` — or `stroke`, which the renderer reads first — carries into that series' legend swatch and tooltip dot. |
|
|
99
|
+
| `fillOpacity` | `number` | `0.3` | no | Fill opacity of each radar area. |
|
|
100
|
+
| `strokeWidth` | `number` | `2` | no | Stroke width of each radar outline. |
|
|
101
|
+
| `showDots` | `boolean` | `false` | no | Render a dot at each axis point. |
|
|
102
|
+
| `dotRadius` | `number` | `3` | no | Radius of the per-point dots when `showDots` is on. |
|
|
103
|
+
| `activeDot` | `boolean` | `true` | no | Enlarge the hovered point's dot. On by default; `false` for a chart that should not react to the pointer. |
|
|
104
|
+
| `showGrid` | `boolean` | `true` | no | Render the polar grid (the web). |
|
|
105
|
+
| `radialLines` | `boolean` | `true` | no | Draw the grid's spokes (the radial lines out to each category). Off leaves only the concentric rings. |
|
|
106
|
+
| `showAngleAxis` | `boolean` | `true` | no | Render the categorical axis chrome (spoke labels, tick lines, outer line). The axis itself is kept either way, so the tooltip still names each category. |
|
|
107
|
+
| `angleAxisOrientation` | `'inner' | 'outer'` | `'outer'` | no | Place the spoke labels outside the web or inside it. |
|
|
108
|
+
| `angleAxisLine` | `boolean` | `true` | no | Draw the line around the web that the spoke labels sit against. |
|
|
109
|
+
| `angleAxisLineType` | `'polygon' | 'circle'` | `'polygon'` | no | Shape of that line. Independent of `gridType`, so pair them to keep a circular web's outline circular. |
|
|
110
|
+
| `angleTickLine` | `boolean` | `true` | no | Draw a tick line from the axis line to each spoke label. |
|
|
111
|
+
| `angleTickSize` | `number` | — | no | Distance from the web to the spoke labels, in px. Left unset, `showLabels` widens it so a vertex's value clears its category label. |
|
|
112
|
+
| `showRadiusAxis` | `boolean` | `false` | no | Render the value scale — a radial axis of ticks from the centre outward, so an area reads as a number and not only as a comparison. Only `radiusAxisAngle` and `radiusAxisOrientation` need it shown; `radiusAxisDomain`, `radiusAxisReversed` and `radiusAxisTickCount` apply either way. |
|
|
113
|
+
| `radiusAxisAngle` | `number` | `0` | no | Angle the value scale is drawn at, in degrees counter-clockwise from 3 o'clock. Point it between two spokes — along one, its outermost tick collides with that category's own label. The ticks sit over the areas at any angle. |
|
|
114
|
+
| `radiusAxisOrientation` | `'left' | 'right' | 'middle'` | `'right'` | no | Which side of the scale its tick labels sit on. |
|
|
115
|
+
| `radiusAxisDomain` | `'auto' | 'fixed'` | — | no | How the value scale (and with it the web) is bounded. Unset — the data's largest value reaches the outer ring; `fixed` — the outer ring is `radiusAxisDomainMax`, which is what makes the radar an absolute profile; `auto` — fit the data at both ends. Applies whether or not the scale is shown. |
|
|
116
|
+
| `radiusAxisDomainMax` | `number` | — | no | The value at the outer ring when `radiusAxisDomain` is `fixed`. Must be positive — a `0` or negative maximum cannot bound a scale that grows outward from 0, so it falls back to the data's own top. |
|
|
117
|
+
| `radiusAxisTickCount` | `number` | `5` | no | Desired number of ticks on the value scale (a hint, not exact). Also sets how many rings the grid draws, whether or not the scale is shown. |
|
|
118
|
+
| `radiusAxisReversed` | `boolean` | `false` | no | Invert the value scale (maximum at the centre) for a metric where less is better. |
|
|
119
|
+
| `cx` | `number | string` | `'50%'` | no | Horizontal centre of the web, in px or a percentage of the width. |
|
|
120
|
+
| `cy` | `number | string` | `'50%'` | no | Vertical centre of the web, in px or a percentage of the height. |
|
|
121
|
+
| `startAngle` | `number` | `90` | no | Angle the first category sits at, in degrees. |
|
|
122
|
+
| `endAngle` | `number` | `-270` | no | Angle the sweep ends at, in degrees — a full clockwise turn from `startAngle` by default. |
|
|
123
|
+
| `innerRadius` | `number | string` | `0` | no | Radius of the hole at the centre, in px or a percentage of the available radius. Lifts the grid and the areas off the centre. |
|
|
124
|
+
| `outerRadius` | `number | string` | `'80%'` | no | Outer radius of the web, in px or a percentage of the available radius. |
|
|
125
|
+
| `margin` | `{ top?: number; right?: number; bottom?: number; left?: number }` | — | no | Plot-area margin, in px. Passing the object replaces all four sides; a side left out is `0`, not the default `5`, so name every side. |
|
|
126
|
+
| `showTooltip` | `boolean` | `true` | no | Render the hover tooltip. |
|
|
127
|
+
| `showLegend` | `boolean` | `true` | no | Render the legend. |
|
|
128
|
+
| `legendPosition` | `'top' | 'bottom'` | `'bottom'` | no | Which side of the chart the legend sits on. |
|
|
129
|
+
| `tooltipContent` | `ReactElement | ((props) => ReactNode)` | — | no | Replace the default tooltip. Pass a configured ChartTooltipContent (from this library) — e.g. with a formatter / labelFormatter — to customize the tooltip content without composing recharts. Ignored when showTooltip is false. |
|
|
130
|
+
| `animate` | `boolean` | `false` | no | Enable entrance animation. Off by default so output/baselines are unchanged. |
|
|
131
|
+
| `animationDuration` | `number` | — | no | Animation duration in ms. |
|
|
132
|
+
| `animationBegin` | `number` | — | no | Delay before the animation starts, in ms. |
|
|
133
|
+
| `animationEasing` | `'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear'` | — | no | Easing curve. |
|
|
134
|
+
| `showLabels` | `boolean` | `false` | no | Render a value label on each data point/segment. |
|
|
135
|
+
| `labelPosition` | `'top' | 'bottom' | 'left' | 'right' | 'center' | 'insideTop' | 'insideBottom' | 'insideLeft' | 'insideRight' | 'insideStart' | 'insideEnd'` | — | no | Where the value labels sit. |
|
|
136
|
+
| `labelFormatter` | `(value) => string` | — | no | Format each label value (reuses the tick formatters). |
|
|
137
|
+
|
|
138
|
+
## Behavior
|
|
139
|
+
|
|
140
|
+
`RadarChart` is a typed [recharts](https://recharts.org) composition over the
|
|
141
|
+
shared `Chart` primitives. It plots a set of series (`dataKeys`) over one shared
|
|
142
|
+
angular axis (`angleKey`) inside a `ChartContainer`.
|
|
143
|
+
|
|
144
|
+
```gherkin
|
|
145
|
+
Scenario: Render radar areas from data and config
|
|
146
|
+
Given data rows and a config mapping each series key to a label and color
|
|
147
|
+
And dataKeys ["alice", "bob"]
|
|
148
|
+
Then one <Radar> area renders per dataKey
|
|
149
|
+
And each area strokes and fills from its injected --color-<key> custom property
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
```gherkin
|
|
153
|
+
Scenario: Polygon grid (default)
|
|
154
|
+
Given gridType is "polygon"
|
|
155
|
+
Then the polar grid draws straight-edged rings connecting the spokes
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
```gherkin
|
|
159
|
+
Scenario: Circle grid
|
|
160
|
+
Given gridType is "circle"
|
|
161
|
+
Then the polar grid draws smooth concentric rings
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
```gherkin
|
|
165
|
+
Scenario: Angle axis
|
|
166
|
+
Given an angleKey
|
|
167
|
+
Then each data row contributes one labelled spoke around the web
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
```gherkin
|
|
171
|
+
Scenario: Angle-axis chrome
|
|
172
|
+
Given showAngleAxis is false
|
|
173
|
+
Then no spoke labels, tick lines, or outer axis line render
|
|
174
|
+
And the axis itself is still mounted, so the tooltip names each category
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
```gherkin
|
|
178
|
+
Scenario: Value scale
|
|
179
|
+
Given showRadiusAxis is true
|
|
180
|
+
Then a radial scale of ticks renders from the centre outward at radiusAxisAngle
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
```gherkin
|
|
184
|
+
Scenario: Absolute scaling
|
|
185
|
+
Given radiusAxisDomain is "fixed" and radiusAxisDomainMax is the metric maximum
|
|
186
|
+
Then the outer ring is that maximum rather than the largest value in the data
|
|
187
|
+
And two charts of the same metric are comparable
|
|
188
|
+
And the rescaling applies whether or not the scale is shown
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
```gherkin
|
|
192
|
+
Scenario: Inverted scale
|
|
193
|
+
Given radiusAxisReversed is true
|
|
194
|
+
Then the maximum sits at the centre and 0 at the outer ring
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
```gherkin
|
|
198
|
+
Scenario: Unusable fixed maximum
|
|
199
|
+
Given radiusAxisDomain is "fixed"
|
|
200
|
+
And radiusAxisDomainMax is zero, negative, or not a finite number
|
|
201
|
+
Then the outer ring falls back to the data's own largest value
|
|
202
|
+
And the web is neither collapsed onto its centre nor inverted
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
```gherkin
|
|
206
|
+
Scenario: Grid spokes
|
|
207
|
+
Given radialLines is false
|
|
208
|
+
Then the web keeps its concentric rings and drops the radial spokes
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
```gherkin
|
|
212
|
+
Scenario: Dots
|
|
213
|
+
Given showDots is true
|
|
214
|
+
Then a dot renders where each series crosses each spoke
|
|
215
|
+
And its radius is dotRadius
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
```gherkin
|
|
219
|
+
Scenario: Per-series overrides
|
|
220
|
+
Given seriesSettings has an entry keyed by a plotted dataKeys entry
|
|
221
|
+
Then that series uses the entry's color/stroke/opacity/width/dots
|
|
222
|
+
And a color or stroke override also moves that series' legend swatch and tooltip dot
|
|
223
|
+
And every other series keeps the chart-level values
|
|
224
|
+
And an entry for a key that is not plotted is ignored
|
|
225
|
+
And a deliberately falsy override (zero opacity or width, dots off) wins over the chart-level value
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
```gherkin
|
|
229
|
+
Scenario: Geometry
|
|
230
|
+
Given cx/cy, startAngle/endAngle, innerRadius/outerRadius or margin
|
|
231
|
+
Then the web, its axes, and the areas are all laid out to match
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
```gherkin
|
|
235
|
+
Scenario: Tooltip on hover
|
|
236
|
+
Given showTooltip is true
|
|
237
|
+
When the user hovers near a spoke
|
|
238
|
+
Then a card shows the axis label and one row per series (indicator + value)
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
```gherkin
|
|
242
|
+
Scenario: Legend
|
|
243
|
+
Given showLegend is true
|
|
244
|
+
Then a swatch + label renders for each series in dataKeys
|
|
245
|
+
And legendPosition puts the row below (default) or above the chart
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
```gherkin
|
|
249
|
+
Scenario: Empty data
|
|
250
|
+
Given data is an empty array
|
|
251
|
+
Then the chart renders the grid with no areas and does not throw
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
```gherkin
|
|
255
|
+
Scenario: Entrance animation is opt-in
|
|
256
|
+
Given animate is unset
|
|
257
|
+
Then the series render at their final geometry with no entrance animation
|
|
258
|
+
And the committed visual baselines are unaffected
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
```gherkin
|
|
262
|
+
Scenario: Reduced motion
|
|
263
|
+
Given animate is true
|
|
264
|
+
And a user with prefers-reduced-motion
|
|
265
|
+
Then the entrance animation does not play and the series render at their final geometry
|
|
266
|
+
And the same applies when rendering on the server
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
### Not exposed, and why
|
|
270
|
+
|
|
271
|
+
- **A grid-only inner/outer radius.** recharts ignores a `PolarGrid`'s own
|
|
272
|
+
`innerRadius`/`outerRadius` inside a chart — it takes both from the chart's
|
|
273
|
+
polar view box — so the web's extent is the chart-level `innerRadius` /
|
|
274
|
+
`outerRadius`, which moves the axes and the areas with it.
|
|
275
|
+
- **`connectNulls`.** recharts places a radar point with no value at the centre
|
|
276
|
+
(radius 0) rather than leaving a hole, so there is no gap for a `connectNulls`
|
|
277
|
+
to bridge — a series missing a value renders as a spike into the middle, which
|
|
278
|
+
reads as a zero. Every plotted series therefore needs a value in every row;
|
|
279
|
+
drop the whole category row instead.
|
|
280
|
+
- **A per-series legend marker shape.** The shared `ChartLegendContent` now picks
|
|
281
|
+
a marker from the series' `legendType` (swatch / line / dashed), so a per-series
|
|
282
|
+
shape became expressible once that rework landed. It stays unexposed here on
|
|
283
|
+
purpose: a radar paints filled areas, so every series wants the swatch, and
|
|
284
|
+
choosing per series is a design call across the whole chart suite rather than
|
|
285
|
+
one component's prop.
|
|
286
|
+
|
|
287
|
+
## Accessibility
|
|
288
|
+
|
|
289
|
+
- recharts' `accessibilityLayer` is **on by default** (recharts v3), giving the
|
|
290
|
+
chart keyboard focus and an accessible description of the plotted points.
|
|
291
|
+
- A radar chart is inherently visual (and hard to read precisely — overlapping
|
|
292
|
+
areas, angular value judgement). **Pair it with a text alternative** — a
|
|
293
|
+
caption, a summary, or an adjacent data table carrying the same numbers — and
|
|
294
|
+
give the chart an accessible name (`aria-label` / `aria-labelledby` referencing
|
|
295
|
+
a visible heading). The wrapper forwards native `div` attributes, so `aria-*`
|
|
296
|
+
pass through.
|
|
297
|
+
- Do **not** rely on color alone to distinguish series. Keep `showLegend` (or the
|
|
298
|
+
tooltip) visible so each color is paired with a text label; keep `fillOpacity`
|
|
299
|
+
low enough that overlapping areas remain distinguishable.
|
|
300
|
+
- The chrome (tooltip, legend, polar grid) resolves to semantic `--ui-*` tokens
|
|
301
|
+
that meet contrast in light and dark. The component adds a local override so the
|
|
302
|
+
**angle-axis (spoke) labels** use `muted-foreground` — without it they render
|
|
303
|
+
near-black and disappear in dark mode (the shared container themes only
|
|
304
|
+
cartesian axis ticks; this is a tracked shared-primitives gap). **Series colors
|
|
305
|
+
are caller-supplied** via `config` — pick values that meet 3:1 against the
|
|
306
|
+
surface and are distinguishable for color-vision deficiencies. The borrowed
|
|
307
|
+
semantic tokens are a design-pending stopgap until the `--ui-chart-*` palette
|
|
308
|
+
lands.
|
|
309
|
+
- Watch recharts issue [#4809](https://github.com/recharts/recharts/issues/4809)
|
|
310
|
+
on the a11y layer for heavily-customized charts.
|
|
311
|
+
|
|
312
|
+
## Contrast
|
|
313
|
+
|
|
314
|
+
Chart chrome and the spoke labels meet contrast in both themes via the semantic
|
|
315
|
+
tokens. Radar area fills/strokes come from `config` and are the caller's
|
|
316
|
+
responsibility — translucent overlapping fills lower effective contrast.
|