The inline loading component provides visual feedback that data is being processed.
import { InlineLoading } from "@wfp/react"
() => { const [loading, setLoading] = useState(true); return ( <> {loading ? ( <InlineLoading iconDescription="Active loading indicator" description="Loading data..." success={false} // onSuccess={onSuccess} /> ) : ( <div>The content after loading</div> )} </> ); };
() => { return ( <InlineLoading description="Success message" success={true} /> ); };
() => { return ( <InlineLoading description="Error message" fail={true} /> ); };
import { InlineLoading } from "@wfp/react";
// `#my-inline-loading` is an element with `[data-inline-loading]` attributeInlineLoading.create(document.getElementById("my-inline-loading"));
Name | Type | Description |
---|---|---|
states | Object | The loading states. Contains INACTIVE , ACTIVE and FINISHED properties. |
Name | Params | Description |
---|---|---|
release | Deletes the instance | |
setState | state : string | Sets the active/inactive/finished state |
// `#my-inline-loading` is an element with `[data-inline-loading]` attributevar inlineLoadingInstance = InlineLoading.create(document.getElementById("my-inline-loading"));inlineLoadingInstance.setState(InlineLoading.states.FINISHED);
Option | Default Selector | Description |
---|---|---|
selectorInit | [data-inline-loading] | The CSS selector to find the inline loading components |
selectorSpinner | [data-inline-loading-spinner] | The CSS selector to find the spinner |
selectorFinished | [data-inline-loading-finished] | The CSS selector to find the "finished" icon |
selectorTextActive | [data-inline-loading-text-active] | The CSS selector to find the text describing the active state |
selectorTextFinished | [data-inline-loading-text-finished] | The CSS selector to find the text describing the finished state |
classLoadingStop | .wfp--loading--stop | The CSS class for spinner's stopped state |