Componentform0.93 KB gzipZero dependencies
EmailInput
Email input with live validation and typo domain suggestions
Preview
Live Preview
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add email-inputOr install the full npm package:
npm install bigbulluiUsage
tsx3 lines
import { EmailInput } from "@/components/ui/email-input"; <EmailInput defaultValue="test@example.com" validate onValueChange={(v) => {}} />Source code
email-input.tsx + 1 helperZero third-party dependencies (2 local files shown in tabs below).
tsxemail-input.tsx102 lines
"use client"; import * as React from "react";import { cn } from "./lib/utils"; export interface EmailInputProps extends Omit<React.HTMLAttributes<HTMLElement>, "value" | "defaultValue"> { value?: string; defaultValue?: string; onValueChange?: (value: string) => void; validate?: boolean; className?: string;} const SUGGESTION_DOMAINS = [ { domain: "gmail.com", suggestion: "DID YOU MEAN" }, { domain: "yahoo.com", suggestion: "DID YOU MEAN" }, { domain: "outlook.com", suggestion: "DID YOU MEAN" },];Props
Interactive Prop Playground
Tweak parsed AST props below to generate ready-to-paste JSX.
tsx3 lines
import { EmailInput } from "@/components/ui/email-input"; <EmailInput />| Prop | Type | Description |
|---|---|---|
| value | string | Controlled value. |
| defaultValue | string | Initial value when uncontrolled. (Default: "") |
| onValueChange | (value: string) => void | Callback invoked on value change. |
| validate | boolean | Toggles validate. (Default: true) |
| className | string | Optional Tailwind or custom CSS classes merged with component styles. |