We use cookies to ensure you get the best experience on our website. Read our privacy policy

Skip to main content

Directory

Frame Component

The Frame component provides a robust solution for embedding external content like PDFs, webpages, and other resources with intelligent loading states and optimized performance.

  • Check Circle

    Smart Loading: Built-in loading indicators

  • Check Circle

    Lazy Loading By Default: Optimized performance with configurable preloading

  • Check Circle

    Responsive Design: Full-width and height containment

Embed external content with minimal configuration:

<Frame src="https://example.com/embedded-content" />

Configure when the iframe should start loading before it enters the viewport:

<Frame
src="https://example.com/content"
data-preload-distance="200"
/>

The data-preload-distance attribute defines the distance in pixels from the viewport when preloading should begin.

Frame Component Extends <div> HTMLElement
Prop Type Default Description
src string required URL of the content to embed
iframeProps HTMLAttributesWithData<"iframe"> { loading: "lazy" } Props passed directly to the iframe element
preloadDistance number Distance in pixels to trigger preloading
  1. Performance Optimization

    • Use lazy loading for below-the-fold content
    • Set appropriate preload distances for critical content
    • Consider the impact on page load time
  2. Security Considerations

    • Only embed content from trusted sources
    • Use appropriate sandbox attributes when needed
    • Consider content security policies
  3. Accessibility

    • Provide title attributes for screen readers
    • Ensure embedded content is accessible
    • Consider fallback content when appropriate
PDF Viewer
External web pages
Interactive maps
Social media feeds
Payment forms

Limited Time Launch Sale

Start building secure, accessible websites today with our AstroJS starter template. Get instant access to the Frame component and more!

GET 60% OFF!
North Star Themes Logo

Subscribe to our newsletter

Get the latest AstroJS tips and tricks right to your inbox

Email: [email protected]

© 2025 North Star Themes

Web Kit Provided By North Star Themes