Provider Fallback Badge
Surfaces the active AI backend tier (zero-download built-in vs model-download provider) and a WASM threading variant.
Provider Fallback Badge
The Provider Fallback Badge surfaces the active AI backend tier — a zero-download built-in (Chrome AI) vs a model-download provider (Transformers.js) — plus a WASM threading variant ("Multi-thread" when cross-origin isolated / SharedArrayBuffer is available, else "Single-thread"). It is a software-side sibling to the Device Badge (which surfaces hardware).
Preview
Installation
pnpm dlx shadcn@latest add @localmode/ui/local-first/provider-fallback-badgenpx shadcn@latest add @localmode/ui/local-first/provider-fallback-badgeyarn dlx shadcn@latest add @localmode/ui/local-first/provider-fallback-badgebunx --bun shadcn@latest add @localmode/ui/local-first/provider-fallback-badgeData source & dependencies
Data source: reads the threading capability via the bundled useCapabilities navigator hook (the active-tier prop is yours to pass) — self-contained, works in any React app. (It mirrors useCapabilities from @localmode/react.)
@localmode/ui/lib/use-environment— the bundleduseCapabilitiesnavigator hook (installed automatically as a registry dependency)lucide-react— iconsclsx+tailwind-merge— via the sharedcn()util (installed automatically as a registry dependency)
Files installed
provider-fallback-badge.tsx— theProviderFallbackBadgecomponentlib/use-environment.ts— the bundleduseCapabilitiesnavigator hooklib/utils.ts— thecn()helper (if not already present)
Props
ProviderFallbackBadge
Prop
Type
Examples
Built-in vs download provider
<ProviderFallbackBadge tier="built-in" providerName="Chrome AI" />
<ProviderFallbackBadge tier="download" providerName="Transformers.js" />Customization
The threading flag falls back to useCapabilities then globalThis.crossOriginIsolated when not passed. Hide the threading sub-badge with hideThreading. Styled entirely with shadcn/ui CSS-variable utilities so it inherits your theme — because you own the copied file, every class and threshold is yours to change.
Browser Compat Card
A per-model runnability report: a pass/fail RAM-headroom bar, storage, threading, estimated speed, warnings, and a canRun gate. RAMUsageBar is independently usable.
Storage Meter
IndexedDB / origin storage usage versus quota, with a warning threshold and a graceful unavailable state.