---
title: "MazReadingProgressBar"
description: "MazReadingProgressBar is a standalone component to display a reading progress bar"
package: "maz-ui"
url: "https://maz-ui.com/components/maz-reading-progress-bar"
---

# MazReadingProgressBar

> MazReadingProgressBar is a standalone component to display a reading progress bar

- Package: `maz-ui`
- Import: `import MazReadingProgressBar from 'maz-ui/components/MazReadingProgressBar'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/components/maz-reading-progress-bar

> Before use it, you should install the MazUi plugin in your project, follow instructions in [Getting Started](../guide/getting-started.md)

This component use the `<Teleport />` component to move the progress bar to the top of the page. You can set the `teleport-selector` prop to change the target of the teleportation.

## Basic usage

Look at the top of the page to see the component in action (scroll in page to inscrease progress bar width).

```vue
<script lang="ts" setup>
import MazReadingProgressBar from 'maz-ui/components/MazReadingProgressBar'
</script>

<template>
  <MazReadingProgressBar content-selector=".VPDoc" teleport-selector="#app" />
</template>
```

## Types

### Props

```ts
export interface Props {
  /**
   * Height of the progress bar
   * @default 4px
   */
  height?: string
  /**
   * Color of the progress bar
   * @default primary
   */
  color?: Color
  /**
   * Selector of the element to teleport the progress bar
   * @default body
   */
  teleportSelector?: string
  /**
   * Selector of the element to get the height
   * @default body
   */
  contentSelector?: string
  /**
   * Offset of the progress bar
   * @default 0
   */
  offset?: number
  /**
   * Class of the progress bar
   * @default undefined
   */
  barClass?: HTMLAttributes['class']
  /**
   * Instead of using the height of the content with a selector, you can set a scroll distance
   * @default undefined
   */
  distance?: number
}
```

## MazReadingProgressBar API

`import MazReadingProgressBar from 'maz-ui/components/MazReadingProgressBar'`

### Props

- `height` (`string`, default: `"4px"`): Height of the progress bar.
- `color` (`"primary" | "secondary" | "accent" | "info" | "success" | "warning" | "destructive" | "contrast" | "transparent"`, default: `"primary"`): Color of the progress bar.
- `teleport-selector` (`string`, default: `"body"`): Selector of the element to teleport the progress bar.
- `content-selector` (`string`, default: `"body"`): Selector of the element to get the height.
- `offset` (`number`, default: `0`): Offset of the progress bar.
- `bar-class` (`ClassValue`): Class of the progress bar.
- `distance` (`number`): Instead of using the height of the content with a selector, you can set a scroll distance.

### Events

- `@begin`
- `@complete`
