@molecule/app-progress-rings-solid
v1.1.0
Published
Apple-Health-style SVG progress rings (single + concentric triad) — health summaries, onboarding, OKR
Readme
@molecule/app-progress-rings-solid
Solid Apple-Health-style concentric SVG progress rings — single + triad.
Exports ProgressRings for one or more rings rendered as a single SVG — the
Solid counterpart of @molecule/app-progress-rings-react, with the same
props (React names) and the same DOM for the same input, so an app switches
framework by changing only the package name in its imports.
Auto-generated, AI-first package reference for the molecule.dev ecosystem. It is written to be read by coding agents as much as by people, and is generated from this package's source — edit
src/index.tsJSDoc, not this file.
Quick Start
import { ProgressRings } from '@molecule/app-progress-rings-solid'
export function ActivityRing() {
return (
<ProgressRings
rings={[
{ value: 8200, max: 10000, color: 'var(--color-success)', label: 'Steps' },
{ value: 7, max: 8, color: 'var(--color-info)', label: 'Sleep (hrs)' },
{ value: 35, max: 60, color: 'var(--color-warning)', label: 'Active (min)' },
]}
size={160}
strokeWidth={12}
/>
)
}Type
feature
Installation
npm install @molecule/app-progress-rings-solid @molecule/app-solid @molecule/app-ui @molecule/app-ui-solid solid-jsAPI
Interfaces
ProgressRing
Single ring entry — value/max plus the colored accent and an optional label.
interface ProgressRing {
/** Current progress value. Clamped against `max` at render time. */
value: number
/** Maximum / goal value. Must be > 0; values <= 0 fall back to 1. */
max: number
/**
* SVG stroke color for this ring. Pass a CSS color (token-resolved by the
* caller against the active theme) — the component never hardcodes color.
*/
color: string
/** Optional accessible label for this ring (e.g. "Steps", "Sleep"). */
label?: string
}ProgressRingsProps
Props accepted by the {@link ProgressRings} component.
interface ProgressRingsProps {
/** One or more rings. 1 ring = single circle; 2+ = concentric Apple-Health-style stack. */
rings: ProgressRing[]
/** Outer SVG diameter in px. Defaults to 160. */
size?: number
/** Stroke thickness for each ring in px. Defaults to 12. */
strokeWidth?: number
/** Gap between concentric rings in px (ignored when only one ring). Defaults to 4. */
gap?: number
/**
* Stroke linecap rounding. `'round'` produces the iOS-Health pill caps;
* `'butt'` is flat. Defaults to `'round'`.
*/
cornerRadius?: 'round' | 'butt'
/** Override the outer wrapper classes. */
className?: string
/** `data-mol-id` for AI-agent selectors. */
dataMolId?: string
/** Optional aria-label for the whole graphic. Falls back to translated summary. */
ariaLabel?: string
}Functions
ProgressRings(props)
Apple-Health-style concentric SVG progress rings. Renders a single circular
ring when rings.length === 1, or a nested stack of rings (outermost first)
for 2+ entries. Pure SVG — no canvas, no chart-library dep. Layout resolves
via the wired ClassMap; ring colors come from props (typically resolved from
theme tokens by the caller). The stack is index-keyed (Index), matching
React's per-ring keys, so equal new data keeps the rendered nodes.
function ProgressRings(props: ProgressRingsProps): JSX.Elementprops— Component props (see {@link ProgressRingsProps}).
Returns: The rendered progress rings.
Injection Notes
Requirements
Peer dependencies:
@molecule/app-solid^3.5.0@molecule/app-ui^1.0.1@molecule/app-ui-solid^1.1.0solid-js^1.8.0
Runtime Dependencies
@molecule/app-solid@molecule/app-ui@molecule/app-ui-solidsolid-js
Companion locale bond: @molecule/app-locales-progress-rings (aria summary
- per-ring labels). Ring
coloris any CSS color — pass theme tokens likevar(--color-success)so rings follow the active theme. Requires a wired ClassMap bond; the labels are read throughuseTranslation()so they follow a locale switch. Rings nest outside-in:rings[0]is the outermost.
Translations
Translation strings are provided by @molecule/app-locales-progress-rings.
