npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@askloullc/leadform-embed

v1.0.2

Published

Embeddable lead capture form widget for websites

Readme

LeadForm Embed Widget

A lightweight, framework-agnostic lead capture form widget that can be embedded on any website. Built with TypeScript and includes both script-based embedding and a React component for easy integration.

🚀 Quick Start

Features

  • 🪶 Lightweight: Only 4.6KB gzipped
  • 🎨 Customizable: Multiple themes and configurations
  • 🔒 Isolated: Uses Shadow DOM to prevent style conflicts
  • 📱 Responsive: Works on desktop and mobile
  • Accessible: Built with accessibility in mind
  • 🌙 Dark mode: Automatic dark mode support
  • 🛡️ Secure: Built-in validation and CSRF protection

Installation & Usage

Script Embed

CDN (Recommended)

Add this script tag to your website:

<script
  src="https://cdn.loubase.com/leadform/1.0.0/index.iife.min.js"
  integrity="sha384-PASTE_SRI_FROM_CI"
  crossorigin="anonymous"
  data-site-slug="YOUR_SITE_SLUG"
  data-site-public-key="YOUR_PUBLIC_KEY"
  data-mode="floating"
  data-theme="auto"
  data-position="bottom-right"
  data-fields="name,email,company,message"
  data-title="Get in touch"
  data-button-text="Contact us"
  data-success-message="Thanks — we'll reply ASAP."
  data-require-consent="true"
></script>

NPM

npm install @loubase/leadform-embed
import { LeadFormWidget } from '@loubase/leadform-embed';

new LeadFormWidget({
  siteSlug: 'your-site-slug',
  sitePublicKey: 'your-public-key',
  theme: 'auto',
  position: 'bottom-right',
  fields: ['name', 'email', 'company', 'message'],
  title: 'Get in touch',
  buttonText: 'Contact us',
  successMessage: 'Thanks — we\'ll reply ASAP.',
  requireConsent: true
});

React Component

For React applications, use the React component:

npm install @loubase/leadform-embed
import { SimpleLeadForm } from '@loubase/leadform-embed/react'

function App() {
  return (
    <SimpleLeadForm
      siteSlug="your-site-slug"
      sitePublicKey="your-public-key"
      title="Contact Us"
      fields={['name', 'email', 'message']}
      theme="auto"
      onSubmit={(data) => console.log('Form submitted:', data)}
      onError={(error) => console.error('Form error:', error)}
    />
  )
}

👉 See complete React documentation

Configuration Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | siteSlug | string | Required | Your unique site slug | | sitePublicKey | string | Required | Your site's public key | | theme | 'light' \| 'dark' \| 'auto' | 'auto' | Color theme | | position | 'bottom-right' \| 'bottom-left' \| 'top-right' \| 'top-left' \| 'center' | 'bottom-right' | Position of the form | | fields | string[] | ['name', 'email', 'message'] | Form fields to display | | title | string | 'Get in touch' | Form title | | buttonText | string | 'Contact us' | Submit button text | | successMessage | string | 'Thanks — we\'ll reply ASAP.' | Success message | | requireConsent | boolean | false | Show privacy consent checkbox | | requireMarketingConsent | boolean | false | Show marketing consent checkbox | | accentColorHex | string | '#3b82f6' | Primary color (hex format) | | apiEndpoint | string | 'https://api.loubase.com/leads' | Custom API endpoint |

Available Fields

  • name - Full name (required)
  • email - Email address (required, validated)
  • company - Company name
  • phone - Phone number
  • message - Message textarea

Styling & Themes

The widget automatically adapts to your site's color scheme:

  • Auto: Follows system preference (light/dark)
  • Light: Always uses light theme
  • Dark: Always uses dark theme

All styles are encapsulated in Shadow DOM to prevent conflicts with your site's CSS.

Content Security Policy

If you use CSP, add these directives:

Content-Security-Policy:
  script-src 'self' https://cdn.loubase.com 'sha384-PASTE_SRI_HASH';
  connect-src 'self' https://api.loubase.com;
  style-src 'self' 'unsafe-inline';

API Endpoint

The widget submits form data to your configured endpoint with this payload:

{
  "siteSlug": "your-site-slug",
  "sitePublicKey": "your-public-key",
  "formData": {
    "name": "John Doe",
    "email": "[email protected]",
    "company": "Acme Corp",
    "message": "Hello!"
  },
  "source": "embed",
  "timestamp": "2024-01-01T00:00:00.000Z",
  "url": "https://example.com/page",
  "userAgent": "Mozilla/5.0..."
}

Expected response for success:

{
  "success": true,
  "id": "lead-123"
}

Development

# Install dependencies
pnpm install

# Development mode (watch)
pnpm run dev

# Build for production
pnpm run build

# Type checking
pnpm run typecheck

Browser Support

  • Chrome 63+
  • Firefox 63+
  • Safari 11.1+
  • Edge 79+

License

UNLICENSED - © Lou LLC

old update embed

const config = getConfig(); const fields = config.fields.join(','); const embedCode = <script src="https://cdn.loubase.com/leadform/1.0.0/index.iife.min.js" data-site-id="${config.siteId}" data-mode="${config.mode}" data-theme="${config.theme}" data-position="${config.position}" data-fields="${fields}" data-title="${config.title}" data-button-text="${config.buttonText}" data-success-message="${config.successMessage}" data-require-consent="${config.requireConsent}/></script>; document.getElementById('embedCode').textContent = embedCode;