Sizes
Any pixel value works — keep it close to the surrounding type for inline use.
SenSpinner is a single accessible SVG. Size in pixels, color through currentColor, screen-reader text built in. Use it inside a button, a panel, or anywhere a moment of patience is needed.
A small motion is enough to mean the system is alive.
Any pixel value works — keep it close to the surrounding type for inline use.
Color comes from currentColor — apply Tailwind text-* utilities and the SVG follows.
Layout is preserved with absolute positioning so the button stays the same width while it loads.
Pair with text when the wait is more than a moment, so the user knows what is happening.
Set the spinner color through Tailwind text-* utilities. The SVG inherits via currentColor.
role="status" and a sr-only label make screen readers announce loading without visual noise.
Drop into a button, an empty state, or beside a label — it is just an SVG.
An inline loading row — colored spinner plus a label.
import { SenSpinner } from 'sen-ui'
export function Loading() {
return (
<div className="flex items-center gap-3">
<SenSpinner size={20} className="text-blue-500" />
<span>Fetching results…</span>
</div>
)
}'use client'
import type { ComponentPropsWithoutRef } from 'react'
export interface SenSpinnerProps {
size?: number
srText?: string
}
export default function SenSpinner({
size = 24,
srText = 'Loading…',
className,
...props
}: SenSpinnerProps & ComponentPropsWithoutRef<'svg'>) {
return (
<div role="status">
<svg
className={['animate-spin text-gray-500', className]
.filter(Boolean)
.join(' ')}
style={{ width: size, height: size }}
viewBox="0 0 24 24"
fill="none"
aria-hidden="true"
{...props}
>
<circle
className="opacity-25"
cx="12"
cy="12"
r="10"
stroke="currentColor"
strokeWidth="4"
/>
<path
className="opacity-75"
fill="currentColor"
d="M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"
/>
</svg>
<span className="sr-only">{srText}</span>
</div>
)
}