Spinner
A 2px currentColor open-arc loading indicator in the Brutalist family with reduced-motion support.
Spinner is a visual-only loading indicator in the Brutalist family drawn as a 2px currentColor open-arc circular ring with no fill or soft shadow, suited for inline buttons, badges, and async status regions.
Preview
Section titled “Preview”<div id="brutalist-spinner-hero" class="flex flex-col gap-4">
<div class="flex flex-wrap items-center gap-4">
<proto-ui-brutalist-spinner-root
data-size="sm"
></proto-ui-brutalist-spinner-root>
<proto-ui-brutalist-spinner-root
data-size="md"
></proto-ui-brutalist-spinner-root>
<proto-ui-brutalist-spinner-root
data-size="lg"
></proto-ui-brutalist-spinner-root>
</div>
<proto-ui-base-async-region-root
id="spinner-busy-region"
class="flex items-center gap-3 rounded-[5px] border-2 border-black bg-[var(--pui-secondary-background)] px-3.5 py-2.5 text-sm font-medium text-[var(--pui-foreground)] shadow-[4px_4px_0_0_#000]"
>
<proto-ui-brutalist-spinner-root></proto-ui-brutalist-spinner-root>
Loading results…
</proto-ui-base-async-region-root>
<div class="flex items-center gap-3">
<proto-ui-brutalist-button>
<proto-ui-brutalist-spinner-root
data-size="sm"
></proto-ui-brutalist-spinner-root>
Saving…
</proto-ui-brutalist-button>
</div>
</div>
<script type="module">
import { setElementProps } from '@proto.ui/adapter-web-component';
document
.querySelectorAll(
'#brutalist-spinner-hero proto-ui-brutalist-spinner-root[data-size]'
)
.forEach((el) => {
if (el instanceof HTMLElement && el.dataset.size) {
setElementProps(el, { size: el.dataset.size });
}
});
const region = document.querySelector('#spinner-busy-region');
if (region instanceof HTMLElement)
setElementProps(region, { busy: true });
</script>Installation
Section titled “Installation”Available starting in 0.3.0-rc.1 and later releases. Import the prototype from @proto.ui/prototypes-brutalist/spinner (workspace CLI target: brutalist-spinner).
import { BrutalistSpinnerRoot } from '../proto-ui/components/react';
export function Example() { return <BrutalistSpinnerRoot size="md" />;}- Sizes:
sizeaccepts'sm'(16px),'md'(24px, default), and'lg'(32px); removing the prop restores'md'. - Reduced motion: Rotates linearly once every 1000ms by default. Under
prefers-reduced-motion: reduce, rotation stops while the open arc remains visible as a non-color orientation cue. - Parent-owned semantics: Spinner is always contentless,
aria-hidden="true", roleless, and non-focusable. Compose it inside a parent Button, Badge, orAsync Regionthat ownsaria-busy, accessible text, timing, and focus continuity.
Examples
Section titled “Examples”Use the size prop to switch between 'sm' (16px), 'md' (24px), and 'lg' (32px).
<div
id="brutalist-spinner-sizes"
class="flex flex-wrap items-end gap-6"
>
<div class="flex flex-col items-center gap-2">
<proto-ui-brutalist-spinner-root
data-size="sm"
></proto-ui-brutalist-spinner-root>
<span class="text-xs font-medium">sm (16px)</span>
</div>
<div class="flex flex-col items-center gap-2">
<proto-ui-brutalist-spinner-root
data-size="md"
></proto-ui-brutalist-spinner-root>
<span class="text-xs font-medium">md (24px)</span>
</div>
<div class="flex flex-col items-center gap-2">
<proto-ui-brutalist-spinner-root
data-size="lg"
></proto-ui-brutalist-spinner-root>
<span class="text-xs font-medium">lg (32px)</span>
</div>
</div>
<script type="module">
import { setElementProps } from '@proto.ui/adapter-web-component';
document
.querySelectorAll(
'#brutalist-spinner-sizes proto-ui-brutalist-spinner-root'
)
.forEach((el) => {
if (el instanceof HTMLElement && el.dataset.size) {
setElementProps(el, { size: el.dataset.size });
}
});
</script>In Button
Section titled “In Button”Place a size="sm" Spinner inside Brutalist Button so it inherits currentColor while the button owns disabled state and accessible label text.
<div
id="brutalist-spinner-buttons"
class="flex flex-wrap items-center gap-4"
>
<proto-ui-brutalist-button>
<proto-ui-brutalist-spinner-root></proto-ui-brutalist-spinner-root>
Please wait
</proto-ui-brutalist-button>
<proto-ui-brutalist-button>
<proto-ui-brutalist-spinner-root></proto-ui-brutalist-spinner-root>
Saving…
</proto-ui-brutalist-button>
<proto-ui-brutalist-button>
<proto-ui-brutalist-spinner-root></proto-ui-brutalist-spinner-root>
Processing
</proto-ui-brutalist-button>
</div>
<script type="module">
import { setElementProps } from '@proto.ui/adapter-web-component';
const buttonProps = [
{ disabled: true },
{ variant: 'surface', disabled: true },
{ color: 'mint' },
];
document
.querySelectorAll(
'#brutalist-spinner-buttons proto-ui-brutalist-button'
)
.forEach((btn, i) => {
if (btn instanceof HTMLElement)
setElementProps(btn, buttonProps[i]);
});
document
.querySelectorAll(
'#brutalist-spinner-buttons proto-ui-brutalist-spinner-root'
)
.forEach((el) => {
if (el instanceof HTMLElement)
setElementProps(el, { size: 'sm' });
});
</script>With Badge
Section titled “With Badge”Pair Spinner with Brutalist Badge tones (accent, info, danger) to indicate syncing, updating, or processing status.
<div
id="brutalist-spinner-badges"
class="flex flex-wrap items-center gap-3"
>
<proto-ui-brutalist-badge-root>
<span class="inline-flex items-center gap-1.5">
<proto-ui-brutalist-spinner-root></proto-ui-brutalist-spinner-root>
Syncing
</span>
</proto-ui-brutalist-badge-root>
<proto-ui-brutalist-badge-root>
<span class="inline-flex items-center gap-1.5">
<proto-ui-brutalist-spinner-root></proto-ui-brutalist-spinner-root>
Updating
</span>
</proto-ui-brutalist-badge-root>
<proto-ui-brutalist-badge-root>
<span class="inline-flex items-center gap-1.5">
<proto-ui-brutalist-spinner-root></proto-ui-brutalist-spinner-root>
Processing
</span>
</proto-ui-brutalist-badge-root>
</div>
<script type="module">
import { setElementProps } from '@proto.ui/adapter-web-component';
const tones = [
{ tone: 'accent' },
{ tone: 'info' },
{ tone: 'danger' },
];
document
.querySelectorAll(
'#brutalist-spinner-badges proto-ui-brutalist-badge-root'
)
.forEach((badge, i) => {
if (badge instanceof HTMLElement)
setElementProps(badge, tones[i]);
});
document
.querySelectorAll(
'#brutalist-spinner-badges proto-ui-brutalist-spinner-root'
)
.forEach((el) => {
if (el instanceof HTMLElement)
setElementProps(el, { size: 'sm' });
});
</script>Async Region
Section titled “Async Region”Compose Spinner inside an Async Region with busy enabled so the parent container owns aria-busy and exposes readable status text to assistive technology.
<div class="flex w-full max-w-sm flex-col gap-3">
<proto-ui-base-async-region-root
id="spinner-payment-region"
class="flex items-center justify-between gap-4 rounded-[5px] border-2 border-black bg-[var(--pui-secondary-background)] px-4 py-3 text-sm font-medium text-[var(--pui-foreground)] shadow-[4px_4px_0_0_#000]"
>
<div class="flex items-center gap-3">
<proto-ui-brutalist-spinner-root
id="spinner-payment-icon"
></proto-ui-brutalist-spinner-root>
Processing payment…
</div>
<span class="text-xs font-bold">$100.00</span>
</proto-ui-base-async-region-root>
</div>
<script type="module">
import { setElementProps } from '@proto.ui/adapter-web-component';
const region = document.querySelector('#spinner-payment-region');
const icon = document.querySelector('#spinner-payment-icon');
if (region instanceof HTMLElement)
setElementProps(region, { busy: true });
if (icon instanceof HTMLElement)
setElementProps(icon, { size: 'sm' });
</script>Spinner exposes no imperative methods ({}) and defines the following prop on Root:
| Prop | Type | Default |
|---|---|---|
size | 'sm' 'md' 'lg' | md |