Planet Avatar

An avatar that is a planet. The name picks one of its colorways, so the same person always gets the same planet with nothing stored. Circle or squircle.

Open the preview in a new tab

The source comes with full access.

One payment of $149 opens the source right here and lets the CLI install every paid component, with lifetime updates.

Installation

pnpm dlx shadcn add @01orbital/planet-avatar
npx shadcn add @01orbital/planet-avatar
yarn shadcn add @01orbital/planet-avatar
bunx --bun shadcn add @01orbital/planet-avatar

Part of the 01orbital library. With a license, put ORBITAL_TOKEN in .env.local and the same command installs it (licensed install, pricing).

It lands at components/avatar/planet-avatar.tsx, as source you own and edit.

Usage

import { PlanetAvatar } from "@/components/avatar/planet-avatar"

// A review thread: each contributor gets a planet from their name, plus the
// same mark as circle, app tile and favicon.
const THREAD = [
  {
    name: "Loral O'Hara",
    when: "2h",
    line: "L42",
    text: "pull this into a token?",
  },
  { name: "Ulf Merbold", when: "30m", text: "Good catch, done." },
  { name: "Sirisha Bandla", when: "3h", text: "shipping this one." },
]

export default function Demo() {
  return (
    <div className="flex w-fit flex-col gap-8 p-6">
      <ul className="flex flex-col gap-4">
        {THREAD.map((t) => (
          <li key={t.name} className="flex items-start gap-3">
            <PlanetAvatar name={t.name} size={28} />
            <div className="flex flex-col text-sm/5">
              <span>
                <span className="font-medium">{t.name}</span>{" "}
                <span className="text-muted-foreground">{t.when}</span>
              </span>
              <span>
                {t.line && (
                  <span className="mr-1 rounded bg-muted px-1 font-mono text-xs">
                    {t.line}
                  </span>
                )}
                {t.text}
              </span>
            </div>
          </li>
        ))}
      </ul>
      <div className="flex items-end gap-8">
        <figure className="flex flex-col items-center gap-2">
          <PlanetAvatar name="01orbital" palette="planet-14" size={64} />
          <figcaption className="font-mono text-xs tracking-widest text-muted-foreground uppercase">
            Mark
          </figcaption>
        </figure>
        <figure className="flex flex-col items-center gap-2">
          <PlanetAvatar
            name="01orbital"
            palette="planet-14"
            size={64}
            shape="squircle"
          />
          <figcaption className="font-mono text-xs tracking-widest text-muted-foreground uppercase">
            App icon
          </figcaption>
        </figure>
        <figure className="flex flex-col items-center gap-2">
          <PlanetAvatar
            name="01orbital"
            palette="planet-14"
            size={16}
            shape="squircle"
          />
          <figcaption className="font-mono text-xs tracking-widest text-muted-foreground uppercase">
            Favicon
          </figcaption>
        </figure>
      </div>
    </div>
  )
}

API reference

Prop

Type

It also accepts the props of the Base UI part it wraps, and the HTML attributes of the element it renders.

Dependencies

npm: cn. The CLI installs them for you.

Registry pieces it installs with it:

On this page