Nonconformist Propaganda Machine

npm

Bring the best of OSS JavaScript development to your projects with npm Orgs - private packages & team management tools.Learn more »

@manifoldco/ui

0.1.0 • Public • Published

Built With Stencil version (scoped) codecov

🍱 Manifold UI

Manifold’s web component UI library, powered by Stencil.

Installation

npm i @manifoldco/ui

Usage

Framework Supported?
Vanilla JS (no framework)
Angular
React
Vue
Ember

HTML (ES Modules)

<head>
  <link
    rel="stylesheet"
    type="text/css"
    href="https://unpkg.com/@manifoldco/ui/dist/manifold/manifold.css"
  />
</head>
<body>
  <manifold-marketplace></manifold-marketplace>
  <script type="module">
    import { defineCustomElements } from 'https://unpkg.com/@manifoldco/ui/dist/esm/es2017/manifold.define.js';
    defineCustomElements(window);
  </script> 
</body>

HTML (No ESM Support)

<head>
  <link
    rel="stylesheet"
    type="text/css"
    href="https://unpkg.com/@manifoldco/ui/dist/manifold/manifold.css"
  />
</head>
<body>
  <manifold-marketplace></manifold-marketplace>
  <script src="https://unpkg.com/@manifoldco/ui/dist/manifold.js"></script> 
</body>

React

import React from 'react';
import ReactDOM from 'react-dom';
import '@manifoldco/ui/dist/manifold/manifold.css';
import { defineCustomElements } from '@manifoldco/ui/dist/loader';
 
const App = () => <manifold-marketplace />;
 
ReactDOM.render(<App />, document.getElementById('root'));
defineCustomElements(window);

TypeScript + JSX setup

When using inside TypeScript, you’ll likely see this error ( manifold-connection could be any custom element):

Property 'manifold-connection' does not exist on type 'JSX.IntrinsicElements'

To solve that, create a custom-elements.d.ts file somewhere inside your project (must be inside the include option in tsconfig.json):

import { Components } from '@manifoldco/ui';
import { ReactNode } from 'react';
 
interface ReactProps {
  children?: ReactNode;
  // Additional properties may go here as needed
}
 
declare global {
  export namespace JSX {
    interface IntrinsicElements {
      'manifold-marketplace': Components.ManifoldMarketplace & ReactProps;
      'manifold-product': Components.ManifoldProduct & ReactProps;
      'manifold-plan-selector': Components.ManifoldPlanSelector & ReactProps;
    }
  }
}

This will expose the types from Stencil to JSX, and you’ll be able to get typechecking as you write.

*Note: every element will have to be declared manually, at least until this PR is merged in TypeScript core.*🎉

Ember, Angular, Vue, and others

Initializing Manifold UI works the exact same as any other Stencil project. For more advanced instructions on integrating with your specific stack, please refer to Stencil’s docs on integration.

Keywords

none

install

npm i @manifoldco/ui

Downloadsweekly downloads

174

version

0.1.0

license

ISC

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
Report a vulnerability