Smooth, native animations for content swaps using the View Transitions API.

Enabling Transitions

View Transitions are enabled by default. To explicitly control them:

How It Works

When a swap occurs and View Transitions are enabled:

  1. html★ calls document.startViewTransition()
  2. Browser captures a screenshot of the old state
  3. Content is swapped
  4. Browser captures the new state
  5. CSS animations run between the two states

CSS for Transitions

Use view-transition-name to identify elements that should animate:

Animation Examples

Slide

Scale

Crossfade (Simple)

Multiple Elements

Different elements can have different transitions:

CSS Transitions Fallback

When the View Transitions API is unavailable, html★ automatically falls back to CSS class-based transitions. No configuration needed — it just works.

How the Fallback Works

  1. .htmlstar-swapping is added to the target element (triggers fade-out)
  2. html★ waits for the CSS transition to complete
  3. Content is swapped
  4. .htmlstar-swapping is removed, .htmlstar-settling is added (triggers fade-in)
  5. html★ waits for the settle transition
  6. .htmlstar-settling is removed

Default Styles

html★ injects default fallback styles automatically:

Custom Fallback Animations

Override the defaults in your own CSS for custom fallback effects:

The fallback ensures graceful transitions in all browsers, while browsers with View Transitions API support get the full native experience.

Browser Support

BrowserView Transitions APICSS Fallback
Chrome111+
Edge111+
Safari18+
Firefox133+

Graceful Degradation: All modern browsers now support the native View Transitions API. In older browsers, html★ automatically uses the CSS class-based fallback described above — smooth transitions everywhere, no errors, no broken layouts.

Disabling for Specific Swaps