![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
react-losant-dashboard-block
Advanced tools
A component for embedding Losant dashboard blocks in your React.js projects.
Live demo: losant.github.io/react-losant-dashboard-block
The demo shows the block in action displaying the moisture level of the Losant office plants, as found on this dashboard.
To build the examples locally, run:
npm install
npm start
Then open localhost:8000
in a browser.
The easiest way to use the component is to install it from NPM and include it in your own React build process (using Browserify, Webpack, etc).
You can also use the standalone build by including dist/react-losant-dashboard-block.js
in your page. If you use this, make sure you have already included React, and it is available as a global variable.
npm install react-losant-dashboard-block --save
To use the component, simply import it into your React app and then include the tag in your render
function.
import LosantDashboardBlock 'react-losant-dashboard-block';
<LosantDashboardBlock
dashboardId={dashboardId}
blockId={blockId}
theme={theme}
width={width}
height={height}
style={style}
/>
Name | Required? | Description | Default |
---|---|---|---|
dashboardId | Y | String. The ID of the dashboard from which the block is being pulled. | |
blockId | Y | String. The ID of the block. The block MUST come from the dashboard stipulated in the dashboardId . | |
width | String. The width of the iframe in which the block is rendered. Must be in CSS units (e.g. 400px or 100% ). | 100% | |
height | String. The height of the iframe in which the block is rendered. Must be in CSS units (e.g. 400px or 100% ). | 240px | |
theme | String. Must be either light or dark . Additional themes may be supported at a later time. | light | |
style | Object. CSS styles that will be applied to the iframe tag. |
src
, lib
and the build process)NOTE: The source code for the component is in src
. A transpiled CommonJS version (generated with Babel) is available in lib
for use with node.js, browserify and webpack. A UMD bundle is also built to dist
, which can be included without the need for any build system.
To build, watch and serve the examples (which will also watch the component source), run npm start
. If you just want to watch changes to src
and rebuild lib
, run npm run watch
(this is useful if you are working with npm link
).
MIT licensed. Copyright (c) 2017 Losant IoT.
FAQs
React Losant Dashboard Block
We found that react-losant-dashboard-block demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.