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

@utrecht/web-component-library-react

Package Overview
Dependencies
Maintainers
3
Versions
652
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

  • 1.0.3-alpha.40
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
3
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

FAQs

Package last updated on 21 May 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