AI orb
A glowing ball of light for an assistant, in your colour. It rests, sends out rings while it listens and spins faster while it thinks. Press it to see each state.
Options
Code
import "./ai-orb.css";
/* state is "idle", "listening" or "thinking". The colour follows --dh-accent,
and the size follows the font-size of whatever the orb sits in.
<AiOrb state="thinking" /> */
export function AiOrb({ state = "idle", label = "Assistant", ...props }) {
return (
<button className="dh-orb" type="button" data-state={state} aria-label={label + ", " + state} {...props}>
<span className="dh-orb-ball">
<i />
<i />
<i />
</span>
</button>
);
}.dh-orb {
--hue: var(--dh-accent, #2563ff);
--pale: color-mix(in srgb, var(--hue) 30%, #fff);
--deep: color-mix(in srgb, var(--hue) 62%, #000);
--turn: 14s;
position: relative;
display: grid;
place-items: center;
width: 7em;
height: 7em;
padding: 0;
border: 0;
border-radius: 50%;
background: none;
font: inherit;
cursor: pointer;
transition: scale 300ms cubic-bezier(0.23, 1, 0.32, 1);
}
.dh-orb:active {
scale: 0.96;
}
.dh-orb:focus-visible {
outline: 2px solid var(--dh-faint, #8a8a8a);
outline-offset: 0.3em;
}
.dh-orb::before,
.dh-orb::after {
content: "";
position: absolute;
border-radius: 50%;
pointer-events: none;
}
.dh-orb::before {
inset: 6%;
background: var(--hue);
filter: blur(1.1em);
opacity: 0.45;
animation: dh-orb-breathe 4s ease-in-out infinite;
}
.dh-orb::after {
inset: 0;
box-shadow: 0 0 0 1px color-mix(in srgb, var(--hue) 55%, transparent);
opacity: 0;
}
.dh-orb-ball {
position: relative;
width: 72%;
height: 72%;
overflow: hidden;
border-radius: 50%;
background: radial-gradient(circle at 34% 28%, var(--pale), var(--hue) 55%, var(--deep));
box-shadow:
inset 0 0.12em 0.3em rgb(255 255 255 / 0.7),
inset 0 -0.5em 0.9em color-mix(in srgb, var(--deep) 80%, transparent),
0 0 0 1px color-mix(in srgb, var(--hue) 70%, #000),
0 0.35em 0.7em -0.2em color-mix(in srgb, var(--hue) 70%, transparent);
isolation: isolate;
}
.dh-orb-ball i {
position: absolute;
inset: -22%;
border-radius: 50%;
filter: blur(0.55em);
mix-blend-mode: screen;
animation: dh-orb-turn var(--turn) linear infinite;
}
.dh-orb-ball i:nth-child(1) {
background: conic-gradient(from 20deg, transparent 0 18%, #fff 30%, transparent 46% 100%);
opacity: 0.75;
}
.dh-orb-ball i:nth-child(2) {
background: conic-gradient(from 200deg, transparent 0 30%, color-mix(in srgb, var(--hue) 45%, #7ff) 44%, transparent 62% 100%);
animation-duration: calc(var(--turn) * 0.62);
animation-direction: reverse;
}
.dh-orb-ball i:nth-child(3) {
inset: 8% 30% 46% 14%;
background: #fff;
filter: blur(0.45em);
opacity: 0.55;
mix-blend-mode: normal;
animation: none;
}
@keyframes dh-orb-turn {
to {
rotate: 1turn;
}
}
@keyframes dh-orb-breathe {
50% {
scale: 1.14;
opacity: 0.6;
}
}
@keyframes dh-orb-ring {
from {
scale: 0.72;
opacity: 0.9;
}
to {
scale: 1.12;
opacity: 0;
}
}
/* Listening: rings leave the ball, like sound arriving. */
.dh-orb[data-state="listening"] {
--turn: 8s;
}
.dh-orb[data-state="listening"]::after {
animation: dh-orb-ring 1.6s cubic-bezier(0.23, 1, 0.32, 1) infinite;
}
.dh-orb[data-state="listening"] .dh-orb-ball {
animation: dh-orb-breathe 1.6s ease-in-out infinite;
}
/* Thinking: the light inside spins fast and the glow tightens. */
.dh-orb[data-state="thinking"] {
--turn: 2.4s;
}
.dh-orb[data-state="thinking"]::before {
animation-duration: 1.2s;
}
@media (prefers-reduced-motion: reduce) {
.dh-orb::before,
.dh-orb::after,
.dh-orb-ball,
.dh-orb-ball i {
animation: none !important;
}
}<button class="dh-orb" type="button" data-state="idle" aria-label="Assistant, idle. Press to change state">
<span class="dh-orb-ball"><i></i><i></i><i></i></span>
</button>.dh-orb {
--hue: var(--dh-accent, #2563ff);
--pale: color-mix(in srgb, var(--hue) 30%, #fff);
--deep: color-mix(in srgb, var(--hue) 62%, #000);
--turn: 14s;
position: relative;
display: grid;
place-items: center;
width: 7em;
height: 7em;
padding: 0;
border: 0;
border-radius: 50%;
background: none;
font: inherit;
cursor: pointer;
transition: scale 300ms cubic-bezier(0.23, 1, 0.32, 1);
}
.dh-orb:active {
scale: 0.96;
}
.dh-orb:focus-visible {
outline: 2px solid var(--dh-faint, #8a8a8a);
outline-offset: 0.3em;
}
.dh-orb::before,
.dh-orb::after {
content: "";
position: absolute;
border-radius: 50%;
pointer-events: none;
}
.dh-orb::before {
inset: 6%;
background: var(--hue);
filter: blur(1.1em);
opacity: 0.45;
animation: dh-orb-breathe 4s ease-in-out infinite;
}
.dh-orb::after {
inset: 0;
box-shadow: 0 0 0 1px color-mix(in srgb, var(--hue) 55%, transparent);
opacity: 0;
}
.dh-orb-ball {
position: relative;
width: 72%;
height: 72%;
overflow: hidden;
border-radius: 50%;
background: radial-gradient(circle at 34% 28%, var(--pale), var(--hue) 55%, var(--deep));
box-shadow:
inset 0 0.12em 0.3em rgb(255 255 255 / 0.7),
inset 0 -0.5em 0.9em color-mix(in srgb, var(--deep) 80%, transparent),
0 0 0 1px color-mix(in srgb, var(--hue) 70%, #000),
0 0.35em 0.7em -0.2em color-mix(in srgb, var(--hue) 70%, transparent);
isolation: isolate;
}
.dh-orb-ball i {
position: absolute;
inset: -22%;
border-radius: 50%;
filter: blur(0.55em);
mix-blend-mode: screen;
animation: dh-orb-turn var(--turn) linear infinite;
}
.dh-orb-ball i:nth-child(1) {
background: conic-gradient(from 20deg, transparent 0 18%, #fff 30%, transparent 46% 100%);
opacity: 0.75;
}
.dh-orb-ball i:nth-child(2) {
background: conic-gradient(from 200deg, transparent 0 30%, color-mix(in srgb, var(--hue) 45%, #7ff) 44%, transparent 62% 100%);
animation-duration: calc(var(--turn) * 0.62);
animation-direction: reverse;
}
.dh-orb-ball i:nth-child(3) {
inset: 8% 30% 46% 14%;
background: #fff;
filter: blur(0.45em);
opacity: 0.55;
mix-blend-mode: normal;
animation: none;
}
@keyframes dh-orb-turn {
to {
rotate: 1turn;
}
}
@keyframes dh-orb-breathe {
50% {
scale: 1.14;
opacity: 0.6;
}
}
@keyframes dh-orb-ring {
from {
scale: 0.72;
opacity: 0.9;
}
to {
scale: 1.12;
opacity: 0;
}
}
/* Listening: rings leave the ball, like sound arriving. */
.dh-orb[data-state="listening"] {
--turn: 8s;
}
.dh-orb[data-state="listening"]::after {
animation: dh-orb-ring 1.6s cubic-bezier(0.23, 1, 0.32, 1) infinite;
}
.dh-orb[data-state="listening"] .dh-orb-ball {
animation: dh-orb-breathe 1.6s ease-in-out infinite;
}
/* Thinking: the light inside spins fast and the glow tightens. */
.dh-orb[data-state="thinking"] {
--turn: 2.4s;
}
.dh-orb[data-state="thinking"]::before {
animation-duration: 1.2s;
}
@media (prefers-reduced-motion: reduce) {
.dh-orb::before,
.dh-orb::after,
.dh-orb-ball,
.dh-orb-ball i {
animation: none !important;
}
}document.querySelectorAll(".dh-orb").forEach((orb) => {
const states = ["idle", "listening", "thinking"];
orb.addEventListener("click", () => {
const next = states[(states.indexOf(orb.dataset.state) + 1) % states.length];
orb.dataset.state = next;
orb.setAttribute("aria-label", "Assistant, " + next + ". Press to change state");
});
});AI orb is not in the Figma file yet.
Use the React or HTML code for now.