Spinner
Spinner with thoughtful defaults, semantic styling, and editable source.
Make it yours.
Install the editable source and its dependencies into your React + Tailwind project.
Scroll horizontally for long lines
pnpm dlx shadcn@4.0.8 add http://localhost:3000/r/spinner.jsonUse it
Scroll horizontally for long lines
"use client";
import { Spinner } from "@/components/jez-ui/ui/spinner";
export default function Example() {
return (
<>
<div className="flex items-center gap-5">
<Spinner className="size-8" />
<div>
<h3 className="text-xl">Bringing it together.</h3>
<p className="mt-1 text-sm text-muted-foreground">
Your workspace is getting ready.
</p>
</div>
</div>
</>
);
}
Props & types
Scroll horizontally for long lines
React.ComponentProps<"span"> & { label?: string }Source
View 2 source files
registry/ui/spinner.tsx
Scroll horizontally for long lines
"use client";
import * as React from "react";
import { cn } from "./utils";
export function Spinner({
className,
label = "Loading",
...props
}: React.ComponentProps<"span"> & { label?: string }) {
return (
<span
role="status"
className={cn("inline-flex items-center gap-2 text-sm", className)}
{...props}
>
<span className="size-4 rounded-full border-2 border-border border-t-primary motion-safe:animate-spin" />
<span className="sr-only">{label}</span>
</span>
);
}
registry/ui/utils.ts
Scroll horizontally for long lines
import { clsx, type ClassValue } from "clsx";
import { twMerge } from "tailwind-merge";
export function cn(...values: ClassValue[]) {
return twMerge(clsx(values));
}
Dependencies
clsx@2.1.1 · tailwind-merge@3.5.0
Accessibility & behaviour
Provide meaningful labels and preserve keyboard focus styles. Check contrast when customising theme colours.
Read the accessibility and performance guide →