Skip to main content
Command.Loading renders a role="progressbar" element while asynchronous command items are loading. Conditionally render it based on your loading state — when items are ready, stop rendering it and let Command.Empty or your items take over.
Data attribute: [cmdk-loading]

Props

number
A number between 0 and 100 representing the estimated loading progress. Set as aria-valuenow on the progressbar element. Optional — omit it if you don’t have a meaningful progress value and just want to indicate indeterminate loading.
string
default:"Loading..."
Accessible label for the progressbar. Set as aria-label on the element. Not shown visually. Customize it to describe what is being loaded.

Examples

Conditional rendering with loading state

Render Command.Loading only while fetching, then let normal items or Command.Empty take over:

Determinate progress bar

When you can estimate loading progress, pass a progress value to give screen readers a percentage:

Styling

Always render Command.Empty alongside Command.Loading. Once loading finishes and items are set, if the filtered count drops to zero, Command.Empty will appear automatically.