LoadingWidget
This widget shows a spinning indicator while any deck.gl layers are loading data.
- JavaScript
- TypeScript
- React
import {Deck} from '@deck.gl/core';
import {LoadingWidget} from '@deck.gl/widgets';
import '@deck.gl/widgets/stylesheet.css';
new Deck({
widgets: [
new LoadingWidget({placement: 'top-left'})
]
});
import {Deck} from '@deck.gl/core';
import {LoadingWidget} from '@deck.gl/widgets';
import '@deck.gl/widgets/stylesheet.css';
new Deck({
widgets: [
new LoadingWidget({placement: 'top-left'})
]
});
import React from 'react';
import DeckGL, {LoadingWidget} from '@deck.gl/react';
import '@deck.gl/widgets/stylesheet.css';
function App() {
return (
<DeckGL>
<LoadingWidget placement="top-left" />
</DeckGL>
);
}
Constructor
import {LoadingWidget, type LoadingWidgetProps} from '@deck.gl/widgets';
new LoadingWidget({} satisfies LoadingWidgetProps);
Types
LoadingWidgetProps
The InfoWidget accepts the generic WidgetProps and:
label (string, optional)
- Default:
'Loading data'
Text used as the button's aria-label and displayed as a styled tooltip on hover/focus.
tooltip (string | HTMLElement | false, optional)
- Default: value of
label
Custom tooltip content. Overrides the default label text in the tooltip. Pass false to disable.
onLoadingChange (Function, optional)
(loading: boolean) => void
- Default:
() => {}
Callback when the loading state changes. Called when layers transition between loading and loaded states.