@coveord/plasma-react
TypeScript icon, indicating that this package has built-in type declarations

52.17.0 • Public • Published

Plasma React

Npm total downloads badge npm license

Coveo Administration Console's design system.

Have a look at the demo page!

Getting started

Prerequisites

This repository uses some external libraries defined as peer dependencies. You must install those libraries in you own project in order for @coveord/plasma-react to work properly. All peer dependencies are listed in the package.json file along with their respective version requirements.

Install

npm install @coveord/plasma-react

If you want to use @coveord/plasma-react in a TypeScript context, the package already includes its types.

Usage

In a .jsx context:

const React = require('react');
const ReactDom = require('react-dom');
const Badge = require('@coveord/plasma-react').Badge;

ReactDom.render(<Badge label="Hello Plasma!" />, document.getElementById('SomewhereInYourApp'));

In a .tsx context:

import * as ReactDom from 'react-dom';
import {Badge} from '@coveord/plasma-react';

ReactDom.render(<Badge label="Hello Plasma!" />, document.getElementById('SomewhereInYourApp'));

Dropdowns

All components that implement a dropdown behaviour like the SingleSelect or the MultiSelect will render their content outside the normal DOM hierachy using react portals to avoid some overlapping issues.

The target of that portal is given by the Defaults.DROP_ROOT selector, but you can change this value to something else if you need.

Defaults.DROP_ROOT = '#plasma-dropdowns'; // default

If no DOM element match the specified selector an error will be thrown, so make sure this selector points to an element that always exists in the DOM. Preferably, that element should be outside the hierarchy of the whole app.

Example of a working DOM structure:

<html>
    <head>
        <!-- ... -->
    </head>
    <body className="coveo-styleguide">
        <div id="App"><!-- Your app renders here --></div>
        <div id="plasma-dropdowns"></div>
    </body>
</html>

Contributing

See our main page.

License

@coveord/plasma-react is distributed under Apache 2.0 license.

Package Sidebar

Install

Weekly Downloads

1,754

Version

52.17.0

License

Apache-2.0

Unpacked Size

8.87 MB

Total Files

4665

Last publish

Collaborators

  • coveoit
  • germainbergeron
  • npmcoveord
  • btaillon_cov