Model Loading Panel
A full-height "waiting for model" splash combining metadata, a progress bar, and a first-download-vs-cache-load help message.
Model Loading Panel
The Model Loading Panel is the richer, blocking sibling of the Model Downloader: a full-height "waiting for model" splash that combines model metadata (size, context length, category, a cached-vs-downloading badge) with a progress bar and a two-path help message (first-download vs cache-load). It composes the lower-level DownloadProgress and binds to useModelLoad (progressValue, cached, status).
Preview
Installation
pnpm dlx shadcn@latest add @localmode/ui/local-first/model-loading-panelnpx shadcn@latest add @localmode/ui/local-first/model-loading-panelyarn dlx shadcn@latest add @localmode/ui/local-first/model-loading-panelbunx --bun shadcn@latest add @localmode/ui/local-first/model-loading-panelData source & dependencies
Data source: renders the load state + metadata you pass — works with any backend. Recommended producer: useModelLoad (drive the load) / useModelStatus (read-only view of the same lifecycle) from @localmode/react (on-device, optional).
lucide-react— iconsclsx+tailwind-merge— via the sharedcn()util (installed automatically as a registry dependency)
Registry dependencies
@localmode/ui/local-first/model-downloader— composesDownloadProgress
Files installed
model-loading-panel.tsx— theModelLoadingPanelcomponentlib/utils.ts— thecn()helper (if not already present)
Props
ModelLoadingPanel
Prop
Type
Examples
Blocking load state
import { useModelLoad } from '@localmode/react';
import { webllm, isModelCached } from '@localmode/webllm';
import { ModelLoadingPanel } from '@/components/model-loading-panel';
export function Gate({ children }) {
const { status, progressValue } = useModelLoad({
key: 'Llama-3.2-1B-Instruct-q4f16_1-MLC',
create: (onProgress) =>
webllm.languageModel('Llama-3.2-1B-Instruct-q4f16_1-MLC', { onProgress }),
isCached: () => isModelCached('Llama-3.2-1B-Instruct-q4f16_1-MLC'),
autoLoad: true,
});
if (status !== 'ready') {
return <ModelLoadingPanel name="Llama 3.2 1B" size="1.2 GB" progress={progressValue} />;
}
return children;
}progressValue ({ loaded?, total?, percent, cached? }, percent 0–1) drops straight into the panel's progress prop, and its cached flag (from the isCached probe) flips the help copy between the first-download and cache-load paths.
Customization
The help copy switches on the cached flag (or progress.cached — set automatically when you pass useModelLoad's progressValue). It reuses DownloadProgress from the Model Downloader item, which the CLI installs as a registry dependency. 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.