New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@utrecht/web-component-library-react

Package Overview
Dependencies
Maintainers
0
Versions
655
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@utrecht/web-component-library-react

Component library bundle for the Municipality of Utrecht based on the NL Design System architecture

3.0.3
latest
Source
npm
Version published
Weekly downloads
232
60%
Maintainers
0
Weekly downloads
 
Created
Source

Web Components in React

The @utrecht/web-component-library-stencil package contains the actual implementation of every web component, while the @utrecht/web-component-library-react only contains wrapper React components to provide JSX elements for every Web Component. The implementation of each component will be loaded separately and on-demand, so including the entire component library will not slow down your application.

Install both packages to use React web components in your project:

npm install --save-dev --save-exact \
  @utrecht/web-component-library-react \
  @utrecht/web-component-library-stencil

For example, using Next.js:

import Head from "next/head";
import { UtrechtHeading, UtrechtParagraph, UtrechtDocument } from "@utrecht/component-library-react";

export default function ExamplePage() {
  return (
    <UtrechtDocument>
      <Head>
        <title>Example Page</title>
      </Head>
      <main>
        <UtrechtHeading level={1}>Home</UtrechtHeading>
        <UtrechtParagraph>Hell, world!</UtrechtParagraph>
      </main>
    </UtrechtDocument>
  );
}

Since the implementation of the web components needs to be loaded in the browser, include the following effect to import web component library from @utrecht/web-component-library-stencil, in Next.js this would be in _app.ts:

useEffect(() => {
  import("../public/utrecht/utrecht.esm.js");
}, []);

React Component or React Web Component?

When you're working on a React project and the React component is available, currently you should probably use the React component.

The web components are still experimental. In the future some components might be most convenient to use as web component, and some components might be released exclusively as web component.

Keywords

nl-design-system

FAQs

Package last updated on 15 Feb 2025

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