1.0.12 • Published 9 months ago

@jmeirinkmarimed/age-gate v1.0.12

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

AgeGate: React Age Verification Component

AgeGate is a modular React component that serves as an age verification modal. It prevents underage users from accessing your content and provides flexible integration options—whether you're working with a React project or an HTML website.

Features

  • Age Verification:
    Choose between three verification methods: date inputs, calendar picker, or yes/no confirmation.
  • Persistent Verification:
    Verification status is stored in localStorage so verified users won't need to re-confirm.
  • Customizable Styling:
    Full control over colors, images, fonts, and text with style isolation to prevent CSS conflicts.
  • Universal Support:
    Use as a React component or a custom HTML element.

Getting Started

1. React Projects

  1. Install the package:
npm install @jmeirinkmarimed/age-gate
  1. Import and use the component:
import { AgeGate } from '@jmeirinkmarimed/age-gate';

function App() {
  return (
    <AgeGate 
      minAge={21}
      confirmationType="dateInputs"
      headerText="To enter this site, you need to be 21 or older."
      subHeaderText="Please confirm your age"
      logo="path/to/your/logo.png"
      logoWidth="200px"
      backgroundColor="#000000"
      textColor="#ffffff"
      buttonColor="#ffffff"
      buttonTextColor="#000000"
      buttonHoverColor="#e6e6e6"
      confirmButtonText="Enter"
      fontFamily="Montserrat"
    />
  );
}

2. HTML Websites

  1. Add the script to your page:
<script src="https://unpkg.com/@jmeirinkmarimed/age-gate/dist/age-gate.min.js"></script>
  1. Insert the component anywhere in your HTML:
<age-gate
  min-age="21"
  confirmation-type="dateInputs"
  header-text="To enter this site, you need to be 21 or older."
  sub-header-text="Please confirm your age"
  logo="path/to/your/logo.png"
  logo-width="200px"
  background-color="#000000"
  text-color="#ffffff"
  button-color="#ffffff"
  button-text-color="#000000"
  button-hover-color="#e6e6e6"
  confirm-button-text="Enter"
  font-family="Montserrat"
></age-gate>

Props/Attributes

PropTypeRequiredDefaultDescription
minAgenumberYes-Minimum age required
confirmationTypestringYes-"dateInputs", "calendarPicker", or "yesNo"
headerTextstringYes-Main header text
subHeaderTextstringYes-Secondary header text
logostringYes-Logo image URL
logoWidthstringNo"150px"Width of the logo image
backgroundColorstringNorgba(0, 0, 0, 0.9)Modal background color
textColorstringNo#ffffffText color
buttonColorstringNo#ffffffButton background color
buttonTextColorstringNo#000000Button text color
buttonHoverColorstringNo#e6e6e6Button hover color
backgroundImagestringNo-Background image URL
confirmButtonTextstringNo"Confirm"Button text
fontFamilystringNosystem fontsCustom font family

Confirmation Types

dateInputs

  • Three separate input fields for MM/DD/YYYY
  • Auto-focus progression between fields
  • Automatic confirm button focus when complete

calendarPicker

  • Calendar-style date picker
  • Native date input with confirm button
  • Prevents future dates

yesNo

  • Simple yes/no confirmation buttons
  • Quick verification for simpler use cases

Note on Custom Fonts

When using custom fonts (e.g., Montserrat), ensure you import them properly in your application. For web components, include the font in your HTML head section.

1.0.13

9 months ago

1.0.12

9 months ago

1.0.11

9 months ago

1.0.10

9 months ago

1.0.9

9 months ago

1.0.8

9 months ago

1.0.7

9 months ago

1.0.6

9 months ago

1.0.5

9 months ago

1.0.4

9 months ago

1.0.3

9 months ago

1.0.2

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago