Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@next/font

Package Overview
Dependencies
Maintainers
5
Versions
1038
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@next/font

`@next/font` includes built-in automatic self-hosting for any font file. This means you can optimally load web fonts with zero layout shift, thanks to the underlying CSS size-adjust property used.

  • 15.0.0-canary.10
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
113K
decreased by-18.08%
Maintainers
5
Weekly downloads
 
Created

What is @next/font?

@next/font is a package designed to optimize and manage fonts in Next.js applications. It provides a streamlined way to include and configure custom fonts, Google Fonts, and local fonts, ensuring better performance and easier font management.

What are @next/font's main functionalities?

Custom Fonts

This feature allows you to include custom fonts in your Next.js application by specifying the font source, weight, and style.

import { createFont } from '@next/font';

const myFont = createFont({
  src: '/path/to/font.woff2',
  weight: '400',
  style: 'normal'
});

export default function MyApp() {
  return (
    <div style={{ fontFamily: myFont }}>Hello, world!</div>
  );
}

Google Fonts

This feature allows you to easily include Google Fonts in your Next.js application by specifying the font family, weights, and styles.

import { createGoogleFont } from '@next/font';

const roboto = createGoogleFont({
  family: 'Roboto',
  weights: ['400', '700'],
  styles: ['normal', 'italic']
});

export default function MyApp() {
  return (
    <div style={{ fontFamily: roboto }}>Hello, world!</div>
  );
}

Local Fonts

This feature allows you to include local fonts in your Next.js application by specifying the local path to the font file, weight, and style.

import { createLocalFont } from '@next/font';

const localFont = createLocalFont({
  src: '/local/path/to/font.woff2',
  weight: '400',
  style: 'normal'
});

export default function MyApp() {
  return (
    <div style={{ fontFamily: localFont }}>Hello, world!</div>
  );
}

Other packages similar to @next/font

FAQs

Package last updated on 04 Jun 2024

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc