GooseUI

Components

Circular Text

New

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 available
1 feature
Details
Individual transform properties

Turns the ring with the rotate property, so it never conflicts with transform.

Your browser:

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

npx shadcn@latest add @gooseui/circular-text
pnpm dlx shadcn@latest add @gooseui/circular-text
yarn dlx shadcn@latest add @gooseui/circular-text
bunx --bun shadcn@latest add @gooseui/circular-text

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.

Scroll to explore the library
<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.

Round and round
Clockwise, 10 s
Round and round
Counterclockwise, 6 s
Round and round
Pauses on hover, 20 s
<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

PropTypeDefaultDescription
textstring-Full text, also read by screen readers as one piece
childrenReactNode-Content in the center of the circle
sizenumber160Diameter in px. The default font size is size * 0.11
durationnumber10Seconds per full turn
direction"clockwise" | "counterclockwise""clockwise"Direction of rotation
pauseOnHoverbooleanfalsePause the rotation while the pointer is over the component
separatorstring-Appended after the text so the seam looks even
classNamestring-Classes for the root element
textClassNamestring-Classes for the ring with letters: letter-spacing, uppercase, font size
...propsComponentProps<"div">-Other div attributes (style, id, data-*, aria-*)