Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@stnew/prismic-nextjs

Package Overview
Dependencies
Maintainers
4
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stnew/prismic-nextjs

Prismic components and utilities for Next.js

latest
npmnpm
Version
1.2.6
Version published
Maintainers
4
Created
Source

@stnew/prismic-nextjs

@stnew/prismic-nextjs has peerDepenendencies of react, react-dom, and next. This package assumes you have a basic Next.js app running and have integrated the Prismic client.

This package exports:

  • PrismicLink - A wrapper for next/link that handles link resolution.
  • urlResolver from @stnew/prismic (npm)
  • PrismicContext, PrismicProvider, SliceZone, usePrismic, useHtmlSerializer, serializeElements from @stnew/prismic-react (npm)

The PrismicLink component will take a Prismic link fragment and generate an anchor tag. It's using linkResolver and hrefResolver under the hood, so if you links are not working make sure that you have those set up correctly.

import { PrismicLink } from '@stnew/prismic-nextjs'

function NavItem({ link, label }) {
  return (
    <li>
      <PrismicLink link={link}>{label}</PrismicLink>
    </li>
  )
}
PropRequiredTypeDescription
linkYesPrismicDoc fragmentResolves urls for Prismic "Link" fields
asNoReact Component or stringRenders the a tag as another React component, useful for libraries like styled-components
urlObjectNoUrlObjectTransforms URL object and appends it to the URL, useful for things like query strings. This won't work on external links.

If you're using a css-in-js library like styled-components, you might be wondering how you can style a PrismicLink.

There are a few ways which we've outlined in this doc, for brevity.

FAQs

Package last updated on 17 Nov 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts