astro-loading-indicator
This is an Astro integration that displays a progress bar between page navigations when using View Transitions.
Usage
Prerequisites
- View Transitions enabled on the whole site, view docs.
Installation
Install the package manually:
- Install the required dependencies
pnpm add astro-loading-indicator
npm install astro-loading-indicator
yarn add astro-loading-indicator
- Add the component to your main layout:
import { ViewTransitions } from "astro:transitions";
+import LoadingIndicator from "astro-loading-indicator/component"
<!doctype html>
<html>
<head>
<ViewTransitions />
+ <LoadingIndicator />
</head>
</html>
Configuration
Here is the TypeScript type:
export type Props = {
color: string;
height?: string;
}
color
The indicator background color. Can be any valid CSS property.
<LoadingIndicator
color="#7e22ce"
/>
height
The indicator height. Can be any valid CSS property. Defaults to "2px"
.
<LoadingIndicator
color="..."
height="1rem"
/>
Contributing
This package is structured as a monorepo:
playground
contains code for testing the packagepackage
contains the actual package
Install dependencies using pnpm:
pnpm i --frozen-lockfile
Start the playground:
pnpm playground:dev
You can now edit files in package
. Please note that making changes to those files may require restarting the playground dev server.
Licensing
MIT Licensed. Made with ❤️ by Florian Lefebvre.
Acknowledgements