# PageLoadingLine

> The thin line along the bottom edge of a page's top bar while the page under it loads, as a browser draws it.

Source: https://raft-design.botiverse.build/components/page-loading-line. Generated from the current release; where it differs from what you remember, this page is right.

A page loading line shows that the page under a top bar is loading, the way a browser does: a thin line along the bar's bottom edge that follows the progress the page reports and goes away when it has loaded. Use it for a web page opened inside the app (the in-app browser, a web page in settings, the release notes). Which loading indicator fits which wait is in [Choosing a component](https://raft-design.botiverse.build/components.md#waiting).

```tsx
import { useCallback, useEffect, useState } from "react";
import { ArrowLeft, RotateCw } from "lucide-react";
import { Button, Skeleton } from "@botiverse/raft-ui";
import { PageLoadingLine } from "@botiverse/raft-ui/wip";

/**
 * An in-app web page loading: the line sits on the bottom edge of the page's
 * top bar, follows the progress the web view reports, and fades when the page
 * has loaded. Reload to play it again.
 */
export function PageLoadingLinePreviewContent() {
  const [run, setRun] = useState(0);
  const [value, setValue] = useState<number | null>(null);
  const [loading, setLoading] = useState(true);
  const reload = useCallback(() => {
    setLoading(true);
    setValue(null);
    setRun((r) => r + 1);
  }, []);

  // The progress a web view reports over a three-second load.
  useEffect(() => {
    const steps: [number, () => void][] = [
      [600, () => setValue(20)],
      [1100, () => setValue(45)],
      [1800, () => setValue(70)],
      [2500, () => setValue(90)],
      [3000, () => setLoading(false)],
    ];
    const timers = steps.map(([at, step]) => setTimeout(step, at));
    return () => timers.forEach(clearTimeout);
  }, [run]);

  return (
    <div className="flex w-full max-w-md flex-col overflow-hidden rounded-container border border-line-hairline bg-layer-canvas">
      <div className="relative flex h-11 items-center gap-1 border-b border-line-hairline px-1">
        <Button variant="ghost" size="icon-md" aria-label="Back">
          <ArrowLeft />
        </Button>
        <div className="min-w-0 flex-1 truncate px-1 text-label">Release notes</div>
        <Button variant="ghost" size="icon-md" aria-label="Reload" onClick={reload}>
          <RotateCw />
        </Button>
        <PageLoadingLine loading={loading} value={value} aria-label="Loading page" />
      </div>
      <div className="flex flex-col gap-3 p-4">
        <Skeleton className="h-6 w-2/3" />
        <Skeleton className="h-4 w-full" />
        <Skeleton className="h-4 w-5/6" />
      </div>
    </div>
  );
}
```

## When to use

| Situation                                              | Use                                                                               |
| ------------------------------------------------------ | --------------------------------------------------------------------------------- |
| A page or web view loads under its top bar             | PageLoadingLine                                                                   |
| A task with a known percentage, with a label           | [Progress](https://raft-design.botiverse.build/components/progress.md)                                               |
| The duration is unknown, and there is no bar to sit on | [Spinner](https://raft-design.botiverse.build/components/spinner.md)                                                  |
| The layout of what is loading is known                 | [Skeleton](https://raft-design.botiverse.build/components/skeleton.md), with the line above it when a web view loads |

It is not a variant of Progress. A progress bar names its task, sits on a track with an ink edge, turns `success` when it is full and stays where it is read; the line has no label, no track and no complete color, and it sits on an edge and goes away. Drawn as a Progress, it read as a pill across the top of the page (artin, 2026-11-20, #proj-mobile:#228).

## Anatomy

- `PageLoadingLine`: one part. A 2px `info` line, the full width of the bar, with square ends and no track or border. Put it inside the top bar, which must be `relative` and draws its separator as a 1px `border-b`: the line lies on the bar's outer bottom edge, over the separator, so the two never read as a blue line and a gray one.

## Behavior

The app owns the load and passes `loading`, the `value` the page reports and `failed`; the line owns its timing.

- **Shows late.** It appears only when a load is still going after 200ms, so a page that opens at once never flashes a line.
- **With progress**, it follows the value, easing 200ms to each new one, and only moves forward: a lower value never pulls it back. It stops at 95% while the page still loads: a web engine often reports 100 before the load has ended, so only the end fills the line (Lagoon, mobile#5172, 2026-11-20).
- **Without progress**, it rests still at 8%. It doesn't sweep back and forth: status doesn't loop, and the only looping animation is the pixel spinner ([Motion](https://raft-design.botiverse.build/foundations/motion.md)).
- **When the page has loaded**, it fills to the end and then fades out over 200ms.
- **When the load fails**, it goes at once, and the page shows its error.
- **Reduced motion**: the width jumps to each value, and the line goes at once when the load ends.
- Turning `loading` on again starts a new load from nothing.

## Accessibility

- It renders `role="progressbar"`, with `aria-valuenow` when the page has reported progress and none while it hasn't. Give it a name with `aria-label` ("Loading page").
- Don't hide it from assistive technology: it is the only sign that the page is loading.

## Rules

- Put it only on the bottom edge of a top bar that spans the page. It is the one bar that lies on an edge; never put it along a rounded container's edge, where a bar stays on its own track ([Shape](https://raft-design.botiverse.build/foundations/shape.md#nothing-on-the-edge-of-a-rounded-container)).
- Keep it `info`. Don't color it pink: a load is passive, and pink means something waits for the person.
- One line per page: a web view's own loading line replaces any Progress or spinner at the top.

## API

### PageLoadingLine

The line along the bottom edge of a page's top bar while the page under it loads (page-loading-line.md). Place it inside the bar, which must be `relative`. The consumer owns the load; the line owns its timing: it shows only after 200ms, only moves forward, rests at 8% while there is no progress, and stops at 95% until the load ends, then fills and fades.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `failed` | `boolean` | `false` | The load ended in an error: the line goes at once instead of filling and fading. |
| `loading` (required) | `boolean` |  | True while the page loads. Turning it on again starts a new load. |
| `value` | `number` |  | How far the page has loaded, 0 to 100. Leave it out while the page reports none. |

Also takes the attributes of its element.
