next-hubspot v1.3.0
ā Hubspot Forms for Next.js
Embed HubSpot forms into your Next.js application using hooks.
š³ Tiny and Tree-Shakable
š¦ Written in TypeScript
š¾ Works with multiple forms
š Uses next/script component
Install
yarn add next-hubspotor
npm install --save next-hubspotGetting Started
Wrap your application with HubspotProvider. This will add Hubspot script to your document.
All props are passed directly to the Script tag, so you can use all props from the next/script documentation.
import { HubspotProvider } from 'next-hubspot';
const MyApp = ({ Component, pageProps }) => (
<HubspotProvider>
<Component {...pageProps} />
</HubspotProvider>
)Usage
import { useHubspotForm } from 'next-hubspot';
const HubspotForm = () => {
const { loaded, error, formCreated } = useHubspotForm({
portalId: 'XXXXXXX',
formId: 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX',
target: '#hubspot-form-wrapper'
});
return (
<div id="hubspot-form-wrapper" />
)
}All props are based on the HubSpot docs.
TypeScript
The module is written in TypeScript and type definitions are included.
Contributing
Contributions, issues and feature requests are welcome!
Show your support
Give a āļø if you like this project!
LICENSE
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago