Text laid out along a circle, turning slowly around any content in the middle. It is a server component with no JavaScript: the text is split into graphemes on the server (so emoji, flags and skin tones stay whole), and every letter is rotated by 360deg / n * i in CSS. The whole ring is hidden from assistive technology and the full text is read once as a single string.
Browser Support
Baseline Widely available1 featureDetails
Turns the ring with the rotate property, so it never conflicts with transform.
Preview
The whole block is a link. On hover the arrow leaves up and to the right while its copy arrives from the bottom left, and the block springs up. The arrow swap and the spring are demo classes (group-hover), not part of the component.
Installation
Usage
import { CircularText } from "@/components/ui/circular-text"
export default function Example() {
return (
<CircularText text="Discover your dream property · " size={200} textClassName="text-[22px] font-medium">
<ArrowUpRight aria-hidden="true" />
</CircularText>
)
}Examples
Scroll cue
A separator closes the loop so the seam looks even. Letter-spacing and uppercase come from textClassName.
<CircularText
text="Scroll to explore the library"
separator=" • "
size={180}
textClassName="text-[13px] font-medium uppercase tracking-[0.15em]"
>
<Button asChild size="icon" className="size-14 rounded-full">
<a href="#installation" aria-label="Scroll to the installation section">
<ArrowDown />
</a>
</Button>
</CircularText>Direction, speed and pause
direction reverses the turn, duration sets seconds per revolution, pauseOnHover stops the ring under the pointer, with CSS only. With reduced motion the ring stays still.
<CircularText text="Round and round " duration={10} />
<CircularText text="Round and round " duration={6} direction="counterclockwise" />
<CircularText text="Round and round " duration={20} pauseOnHover />Emoji and graphemes
Intl.Segmenter splits text by user-perceived characters. Each flag is two regional-indicator code points, yet it takes one place on the circle instead of falling apart into two letters. The same goes for a family emoji or a skin tone. Without Intl.Segmenter the server falls back to Array.from.
<CircularText
text="🇯🇵 🇺🇸 🇬🇧 🇫🇷 🇩🇪 🇮🇹 🇪🇸 🇧🇷 🇨🇦 🇰🇷 🇮🇳 🇲🇽 🇦🇺 🇳🇱 🇸🇪 🇹🇷 "
size={200}
duration={24}
textClassName="text-2xl"
/>Props
| Prop | Type | Default | Description |
|---|---|---|---|
| text | string | - | Full text, also read by screen readers as one piece |
| children | ReactNode | - | Content in the center of the circle |
| size | number | 160 | Diameter in px. The default font size is size * 0.11 |
| duration | number | 10 | Seconds per full turn |
| direction | "clockwise" | "counterclockwise" | "clockwise" | Direction of rotation |
| pauseOnHover | boolean | false | Pause the rotation while the pointer is over the component |
| separator | string | - | Appended after the text so the seam looks even |
| className | string | - | Classes for the root element |
| textClassName | string | - | Classes for the ring with letters: letter-spacing, uppercase, font size |
| ...props | ComponentProps<"div"> | - | Other div attributes (style, id, data-*, aria-*) |