Playground

Orbiting circles

Small items circling a centre. Decorative.

  • 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

Two orbits

Decorative only: hidden from assistive tech.

Reverse, slow

Props

OrbitingCirclesProps

PropTypeDefaultDescription
radiusnumber96Orbit radius in px. Default 96.
durationnumber20Seconds for one full turn. Default 20.
reverseboolean–Turn the other way.
ringbooleantrueDraw the orbit as a thin ring. Default true.
centerReactNode–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

ClassStylesheet
.orbitorbiting-circles.css
.orbit-centerorbiting-circles.css
.orbit-itemorbiting-circles.css
.orbit-reverseorbiting-circles.css
.orbit-ringorbiting-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.