rsnext/packages/third-parties
vercel-release-bot 03b7a0fb12 v14.3.0-canary.0
2024-04-15 17:24:31 +00:00
..
src Fix typo in the GTM URL (#62436) 2024-02-26 18:21:12 +00:00
google.d.ts Fix third party typings (#59503) 2023-12-12 01:07:17 +01:00
package.json v14.3.0-canary.0 2024-04-15 17:24:31 +00:00
README.md Updating Third party capital version. (#54418) 2023-08-29 23:13:35 +00:00
tsconfig.json Use new JSX transform (#56294) 2023-12-09 00:17:50 +01:00

Experimental @next/third-parties

@next/third-parties is a collection of components and utilities that can be used to efficiently load third-party libraries into your Next.js application.

Note: @next/third-parties is still experimental and under active development.

Usage

Google Third-Parties

YouTube Embed

The YouTubeEmbed component is used to load and display a YouTube embed. This component loads faster by using lite-youtube-embed under the hood.

import { YouTubeEmbed } from '@next/third-parties/google'

export default function Page() {
  return <YouTubeEmbed videoid="ogfYd705cRs" height={400} />
}

Google Maps Embed

The GoogleMapsEmbed component can be used to add a Google Maps Embed to your page. By default, it uses the loading attribute to lazy-load below the fold.

import { GoogleMapsEmbed } from '@next/third-parties/google'

export default function Page() {
  return (
    <GoogleMapsEmbed
      apiKey="XYZ"
      height={200}
      width="100%"
      mode="place"
      q="Brooklyn+Bridge,New+York,NY"
    />
  )
}

To get a better idea of how these components work, take a look at this demo.