Installation
Getting started with Mantlz SDK for your forms
Installing Mantlz SDK
Mantlz SDK is a modern, customizable React component library for building beautiful forms including feedback, contact, and waitlist forms with dark mode support.
Prerequisites
Before installing Mantlz SDK, make sure you have:
- A React project (Next.js, Create React App, Vite, etc.)
- Node.js (v14 or newer)
- npm, yarn, or pnpm package manager
SDK Compatibility:
Mantlz SDK is compatible with React 18+ and supports both client-side and server-side rendering.
Setup for Next.js
For Next.js applications, we recommend using our specialized package:
npm install @mantlz/nextjs
Adding the Provider
Wrap your application with the MantlzProvider to enable form functionality:
// In your _app.tsx or layout.tsx file
import { MantlzProvider } from "@mantlz/nextjs";
export default function RootLayout({ children }) {
return (
<MantlzProvider apiKey={process.env.MANTLZ_KEY}>
{children}
</MantlzProvider>
);
}
API Key:
You'll need to add your Mantlz API key to your environment variables.
Add MANTLZ_KEY=mk_xxxxxxxxxx
to your .env.local file.
Basic Usage Example
Once installed, you can import and use any of our form components:
import { FeedbackForm } from 'mantlz-sdk';
function MyFeedbackPage() {
return (
<div className="container mx-auto p-4">
<h1 className="text-2xl font-bold mb-4">We value your feedback</h1>
<FeedbackForm
formId="my-feedback-form"
onSubmitSuccess={(data) => console.log('Feedback submitted:', data)}
/>
</div>
);
}