Shapes skeletons
Five skeleton geometry primitives: a circle, a square, a rounded tile, a pill and a bar. The Essentials family varies the animation; this family varies the shape, so every variation shares one calm token pulse and differs only in its outline.
Installation
The styled layer is free and installs like any other ai2 component.
Run the following command
npx shadcn@latest add @ai2/skeleton-shapesDependencies, the @ai2/tokens theme and the component file are installed together.
Install dependencies
npm install motionCopy the source
components/ui/skeleton-shapes.tsx"use client"
import type * as React from "react"
import { motion, useReducedMotion } from "motion/react"
import { cn } from "@/lib/utils"
/* Shapes skeleton family: 5 geometric primitives (circle, square, soft square, pill, bar). The Essentials family changes the ANIMATION; this family changes the SHAPE - the animation is the same calm token pulse in every variant. Colour comes ONLY from tokens; alpha via color-mix(in oklab). Skeletons are decorative: the root is aria-hidden. The pulse stops under reduced motion (a static placeholder). */
export type StyledSize = "sm" | "md" | "lg" | "xl"
type Props = React.ComponentProps<"div"> & { size?: StyledSize }
/* The whole family's shared calm pulse: a framer-motion opacity loop (NO keyframes). */
function Block({ className, delay = 0 }: { className?: string; delay?: number }) {
const reduce = useReducedMotion()
return (
<motion.span
className={cn("block bg-secondary", className)}
animate={reduce ? undefined : { opacity: [0.5, 1, 0.5] }}
transition={
reduce ? undefined : { duration: 1.6, ease: "easeInOut", repeat: Infinity, delay }
}
/>
)
}
/* Kare/daire olcegi (kenar uzunlugu). */
const box: Record<StyledSize, string> = {
sm: "size-8",
md: "size-10",
lg: "size-12",
xl: "size-16",
}
/* Cubuk/hap yuksekligi. */
const bar: Record<StyledSize, string> = {
sm: "h-3",
md: "h-4",
lg: "h-5",
xl: "h-6",
}
/* Hap genisligi. */
const pill: Record<StyledSize, string> = {
sm: "w-16",
md: "w-20",
lg: "w-24",
xl: "w-28",
}
const root = "inline-flex"
/* Circle: tam yuvarlak avatar/ikon yeri. */
export function CircleSkeleton({ className, size = "md", ...props }: Props) {
return (
<div data-slot="styled-skeleton" aria-hidden="true" className={cn(root, className)} {...props}>
<Block className={cn("rounded-full", box[size])} />
</div>
)
}
/* Square: keskin kenarli kare (thumbnail yeri). */
export function SquareSkeleton({ className, size = "md", ...props }: Props) {
return (
<div data-slot="styled-skeleton" aria-hidden="true" className={cn(root, className)} {...props}>
<Block className={cn("rounded-none", box[size])} />
</div>
)
}
/* Rounded: yumusak koseli kare (kart/tile yeri). */
export function RoundedSkeleton({ className, size = "md", ...props }: Props) {
return (
<div data-slot="styled-skeleton" aria-hidden="true" className={cn(root, className)} {...props}>
<Block className={cn("rounded-xl", box[size])} />
</div>
)
}
/* Pill: tam yuvarlatilmis yatay hap (badge/chip yeri). */
export function PillSkeleton({ className, size = "md", ...props }: Props) {
return (
<div data-slot="styled-skeleton" aria-hidden="true" className={cn(root, className)} {...props}>
<Block className={cn("rounded-full", bar[size], pill[size])} />
</div>
)
}
/* Bar: a single full-width bar (a line placeholder). */
export function BarSkeleton({ className, size = "md", ...props }: Props) {
return (
<div
data-slot="styled-skeleton"
aria-hidden="true"
className={cn("flex w-full", className)}
{...props}
>
<Block className={cn("w-full rounded-md", bar[size])} />
</div>
)
}Manual installs skip the @ai2/tokens theme, so add the token CSS from the theming guide or the tone colors will be missing.
Variations
5 takes on the same idea. Each is its own export, and every one accepts a size prop (sm, md, lg, xl) aligned to the base Button scale.
Circle
A round placeholder for an avatar or icon.
import { CircleSkeleton } from "@/components/ui/skeleton-shapes"
<CircleSkeleton />Square
A sharp-cornered square for a thumbnail.
import { SquareSkeleton } from "@/components/ui/skeleton-shapes"
<SquareSkeleton />Rounded
A soft-cornered tile for a card or cover.
import { RoundedSkeleton } from "@/components/ui/skeleton-shapes"
<RoundedSkeleton />Pill
A fully rounded pill for a badge or chip.
import { PillSkeleton } from "@/components/ui/skeleton-shapes"
<PillSkeleton />Bar
A full-width bar that stands in for a line.
import { BarSkeleton } from "@/components/ui/skeleton-shapes"
<BarSkeleton />ai2 Shapes skeletons: 5 styled variations on the token system
The ai2 Shapes skeletons are a set of 5 decorative button variations from the styled layer of the @ai2 design system, built around skeleton geometry primitives that stand in for a shape rather than a line. They are free and MIT licensed, and every color comes from a semantic token, so they theme with the rest of ai2 in light and dark.
Motion runs on framer-motion: framer-motion runs one calm opacity pulse on every shape. The styled layer is opt-in, so the dependency only lands if you use it; the base components stay lean. Under reduced motion, the pulse stops and the shape stays static.
What is in the ai2 Shapes skeletons?
5 exports in one file: Circle, Square, Rounded, Pill and Bar. Each renders a native button and takes a size prop (sm, md, lg, xl) aligned to the base Button. They are separate from the base Button on purpose: the base keeps its clean variant, tone and size axes, while the styled layer carries the effects.
You own the file. Copy the one category file and you have all 5 variations, with no runtime dependency on ai2 itself.
Why use it
- On-system by construction: Every color resolves to an ai2 semantic token, so the buttons follow your theme in light and dark with no extra work.
- Effect without the sprawl: The decorations live in a dedicated styled file, so the base Button keeps its clean, predictable API.
- Accessible and honest: Each renders a real button element, keeps a visible focus ring, and respects prefers-reduced-motion.
Features
- Token-driven color: No hardcoded hex or oklch; the look recolors with your theme tokens.
- framer-motion: framer-motion runs one calm opacity pulse on every shape.
- Reduced-motion aware: Under prefers-reduced-motion, the pulse stops and the shape stays static.
- Size aligned to the base: Every variation takes sm, md, lg and xl matching the base Button height scale, so styled and base buttons line up in a row.
Production tips
- Use it for emphasis, not everywhere: Styled buttons draw the eye. Reserve them for the one action you want people to take on a screen, and use the base Button for the rest.
- Keep labels as verbs: The decoration adds weight, so a clear action label keeps the button scannable.
- Pick one variation per surface: The variations share a family; using two different ones in the same view competes for attention.
Works with the rest of ai2
The Shapes skeletons sit alongside the base Button and the rest of the @ai2 registry. They share the same token file, so a styled action next to a base button or a badge stays visually consistent in both modes.