@boomitra/carbon-calculator
v1.0.12
Published
A versatile Carbon Calculator available as a React package.
Keywords
Readme
Carbon Calculator
A versatile Carbon Calculator available as a React package.
📦 Usage as a React Package
If you have an existing React application, you can install and use the component directly.
1. Installation
npm install @boomitra/carbon-calculator2. Integration
Import the component in your application.
Note: You must pass the host prop to specify the destination URL (e.g., your checkout page) where the user will be redirected when clicking the "Offset" button.
import React from "react";
import CarbonCalculator from "@boomitra/carbon-calculator";
// CSS is automatically injected 🌟
function App() {
const host = "https://your-website.com/checkout"; // URL for redirection
return (
<div className="App">
<h1>Carbon Footprint Calculator</h1>
<CarbonCalculator host={host} />
</div>
);
}
export default App;🛠️ Development
Setup
npm installRun Locally
npm startRuns the app in development mode at http://localhost:5173.
Build Commands
- Build Package:
npm run build- Outputs to
dist-package/ - Used for publishing to npm (ESM + CommonJS).
- Outputs to
