defmodule PUI.Loading do
@moduledoc """
Loading indicators and progress components.
## Topbar Loading Indicator
A progress bar that shows during page transitions and form submissions,
replacing the traditional topbar.js library.
Add to your root layout:
## Customization
Adjust the delay and color:
## How It Works
The loading bar automatically appears when:
- LiveView is navigating between pages
- Forms are being submitted
- `phx-click` events are processing
It automatically hides when the operation completes.
## Attributes
| Attribute | Type | Default | Description |
|-----------|------|---------|-------------|
| `delay` | `integer` | `300` | Milliseconds before showing the bar |
| `class` | `string` | `""` | Additional CSS classes for the bar |
"""
use Phoenix.Component
@doc """
Renders a loading bar component.
## Example
"""
attr :delay, :integer, default: 300
attr :class, :string, default: ""
def topbar(assigns) do
~H"""
"""
end
end