Orbiting circles
Small items circling a centre. Decorative.
SourceStyles source@monoline/react 0.4.0Markdown for AI toolsstable
- Built on native elements
- Decorative: the whole element is aria-hidden, so nothing inside it is read or reachable by assistive tech.
- Under prefers-reduced-motion the items stop, evenly spaced around the ring.
- Styles in one file:
orbiting-circles.css
Import
import '@monoline/css';
import {OrbitingCircles} from '@monoline/react';
Not installed yet? Pick a route.
Copies the source and its styles into your project.
npx monoline add orbiting-circles
Usage
import {OrbitingCircles} from '@monoline/react';
const dot = (t: string) => <span style={{display: 'grid', placeItems: 'center', width: 'var(--s7)', height: 'var(--s7)', border: '1px solid var(--foreground)', background: 'var(--background)', fontSize: 'var(--text-xs)'}}>{t}</span>;
<div style={{display: 'grid', placeItems: 'center'}}>
<OrbitingCircles radius={96} center={dot('M')}>{dot('A')}{dot('B')}{dot('C')}</OrbitingCircles>
</div>
Examples
Reverse, slow
Props
OrbitingCirclesProps
| Prop | Type | Default | Description |
|---|---|---|---|
radius | number | 96 | Orbit radius in px. Default 96. |
duration | number | 20 | Seconds for one full turn. Default 20. |
reverse | boolean | – | Turn the other way. |
ring | boolean | true | Draw the orbit as a thin ring. Default true. |
center | ReactNode | – | Fixed content in the centre. |
Data Attributes
State is exposed through attributes. Style it with these selectors, not with class toggles.
This component sets no state attributes.
CSS classes
| Class | Stylesheet |
|---|---|
.orbit | orbiting-circles.css |
.orbit-center | orbiting-circles.css |
.orbit-item | orbiting-circles.css |
.orbit-reverse | orbiting-circles.css |
.orbit-ring | orbiting-circles.css |
Customization
Style it with the kit's tokens in your own CSS, loaded after @monoline/css. Prefer the attributes above over extra classes. See Theming for every token.
app.css
.orbit {
border-color: var(--accent);
}
Accessibility
- Decorative: the whole element is aria-hidden, so nothing inside it is read or reachable by assistive tech.
- Under prefers-reduced-motion the items stop, evenly spaced around the ring.