Member Login 2
Member login, magic link first: the old password-reset loop sits struck out beside one white card, so a returning member gets back in with a single email field while a password stays one tap away.
Use it in a prompt
Use forms/member-login-2 from the FunnelDNA library. Follow the skill and theme contract. Ask me for the copy, images, and brand details you need; do not invent proof.
Paste into Claude or ChatGPT with FunnelDNA connected (MCP setup), or alongside the skill.
Use it in code
- Save
component.tsx(Code tab) ascomponents/funneldna/forms/member-login-2.tsx. - Import it and pass your copy and images (Props tab):
import { MemberLogin2 } from "@/components/funneldna/forms/member-login-2"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/forms/member-login-2/component.tsx 892 lines
// layout: before-after-split
// Member login, magic link first: the old password-reset loop sits struck out beside one white card, so a returning member gets back in with a single email field while a password stays one tap away.
import * as React from "react";
import { AlertCircle, ArrowBigUp, Eye, EyeOff, KeyRound, Loader2, Mail, X } from "lucide-react";
import { Backdrop, FX_HOST } from "../fx/fx";
import night from "../fx/backdrops/night";
export type MemberLogin2Method = "magic" | "password";
/** What onSubmit receives: the password only when the visitor chose it */
export type MemberLogin2Values = {
method: MemberLogin2Method;
email: string;
password?: string;
};
export type MemberLogin2Copy = {
emailLabel: string;
emailPlaceholder: string;
passwordLabel: string;
passwordPlaceholder: string;
magicAction: string;
passwordAction: string;
magicBusy: string;
passwordBusy: string;
usePassword: string;
useMagic: string;
forgotPassword: string;
showPassword: string;
hidePassword: string;
/** Reassurance under the button while the sign-in link is the method; hidden when empty */
magicNote: string;
capsLock: string;
emailRequired: string;
emailInvalid: string;
passwordRequired: string;
signupPrompt: string;
signupLabel: string;
};
export type MemberLogin2Props = {
/** Text wordmark (with a monogram) when no logo image is supplied */
brandName?: string;
/** logo slot: the app's wordmark on a transparent background */
logoImage?: string;
logoAlt?: string;
headline?: React.ReactNode;
lead?: React.ReactNode;
/** Heading of the struck-out "before" column beside the card (wide layouts only) */
beforeHeading?: React.ReactNode;
/** The friction the magic link removes, shown struck through */
beforeItems?: string[];
/** Italic aside in the founder's voice under the before column */
aside?: React.ReactNode;
/** Stage photo: an fx backdrop asset (a page's scene image replaces it) */
backdropImage?: string;
/** Prefill for a returning member's remembered email */
defaultEmail?: string;
defaultMethod?: MemberLogin2Method;
/** Offer the "Use a password instead" toggle */
allowPassword?: boolean;
forgotHref?: string;
/** Link for visitors without an account; hidden when absent */
signupHref?: string;
/** Form-level message from the host, e.g. an unknown email */
error?: string;
/** The host is processing the submit: the button shows a spinner */
busy?: boolean;
disabled?: boolean;
state?: "default" | "hover" | "active" | "disabled" | "error";
onSubmit?: (values: MemberLogin2Values) => void;
/** Called with the email typed so far */
onForgotPassword?: (email: string) => void;
onMethodChange?: (method: MemberLogin2Method) => void;
copy?: Partial<MemberLogin2Copy>;
className?: string;
};
export function MemberLogin2(props: MemberLogin2Props) {
const {
brandName,
logoImage,
logoAlt,
headline = "Welcome back",
lead = "Enter your email and we’ll send you a one-tap sign-in link.",
beforeHeading = "Skip the password reset loop",
beforeItems = DEFAULT_BEFORE,
aside = "(We’ve all been there. That’s why the link comes first.)",
backdropImage = night,
defaultEmail = "",
defaultMethod = "magic",
allowPassword = true,
forgotHref,
signupHref,
error,
busy = false,
disabled = false,
state = "default",
onSubmit,
onForgotPassword,
onMethodChange,
copy: overrides,
className,
} = props;
const copy: MemberLogin2Copy = { ...DEFAULT_COPY, ...overrides };
const uid = React.useId();
const ids = {
title: `${uid}-title`,
email: `${uid}-email`,
emailError: `${uid}-email-error`,
password: `${uid}-password`,
passwordError: `${uid}-password-error`,
reveal: `${uid}-reveal`,
note: `${uid}-note`,
};
const [method, setMethod] = React.useState<MemberLogin2Method>(allowPassword ? defaultMethod : "magic");
const [email, setEmail] = React.useState(defaultEmail);
const [password, setPassword] = React.useState("");
const [emailTouched, setEmailTouched] = React.useState(false);
const [passwordTouched, setPasswordTouched] = React.useState(false);
const [reveal, setReveal] = React.useState(false);
const [caps, setCaps] = React.useState(false);
const passwordRef = React.useRef<HTMLInputElement>(null);
const passwordDirty = React.useRef(false);
const focusPassword = React.useRef(false);
React.useEffect(() => {
if (!focusPassword.current) return;
focusPassword.current = false;
passwordRef.current?.focus({ preventScroll: true });
}, [method]);
const locked = disabled || state === "disabled";
const isPassword = method === "password";
const trimmed = email.trim();
const emailError = !trimmed ? copy.emailRequired : !isEmail(trimmed) ? copy.emailInvalid : "";
const passwordError = isPassword && !password ? copy.passwordRequired : "";
const forceErrors = state === "error";
const shownEmailError = forceErrors || emailTouched ? emailError : "";
const shownPasswordError = isPassword && (forceErrors || passwordTouched) ? passwordError : "";
const invalid = Boolean(emailError || passwordError);
const hasBefore = Boolean(beforeHeading) || beforeItems.length > 0;
const toggleMethod = () => {
if (locked || !allowPassword) return;
const next: MemberLogin2Method = isPassword ? "magic" : "password";
focusPassword.current = next === "password";
setMethod(next);
setReveal(false);
setCaps(false);
setPasswordTouched(false);
if (next === "magic") {
setPassword("");
passwordDirty.current = false;
}
onMethodChange?.(next);
};
const readCaps = (e: React.KeyboardEvent<HTMLInputElement>) => setCaps(e.getModifierState("CapsLock"));
const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();
if (locked || busy) return;
if (invalid) {
setEmailTouched(true);
if (isPassword) setPasswordTouched(true);
return;
}
onSubmit?.(isPassword ? { method, email: trimmed, password } : { method, email: trimmed });
};
const label = busy
? isPassword ? copy.passwordBusy : copy.magicBusy
: isPassword ? copy.passwordAction : copy.magicAction;
const showNote = !isPassword && Boolean(copy.magicNote);
const initial = brandName ? brandName.trim().charAt(0).toUpperCase() : "";
const wordmark = logoImage ? (
<img className="ml2-logo" src={logoImage} alt={logoAlt ?? brandName ?? ""} />
) : brandName ? (
<div className="ml2-wordmark">
<span className="ml2-mono" aria-hidden="true">{initial}</span>
<span className="ml2-brand">{brandName}</span>
</div>
) : null;
const forgot = forgotHref ? (
<a className="ml2-link" href={forgotHref} onClick={() => onForgotPassword?.(trimmed)}>
{copy.forgotPassword}
</a>
) : onForgotPassword ? (
<button type="button" className="ml2-link" onClick={() => onForgotPassword(trimmed)} disabled={locked}>
{copy.forgotPassword}
</button>
) : null;
const ctaClass = [
"ml2-cta",
state === "hover" ? "is-hover" : "",
state === "active" ? "is-active" : "",
busy ? "is-busy" : "",
]
.filter(Boolean)
.join(" ");
return (
<div className={["cf-member-login-2", className].filter(Boolean).join(" ")} style={FX_HOST}>
<style>{CSS}</style>
<Backdrop src={backdropImage} />
<div className="ml2-scrim" aria-hidden="true" />
<div className={hasBefore ? "ml2-inner" : "ml2-inner ml2-inner--solo"}>
<header className="ml2-head ml2-rise">
{wordmark}
<h2 id={ids.title} className="ml2-title">
{headline}
</h2>
{lead ? <p className="ml2-lead">{lead}</p> : null}
</header>
{hasBefore ? (
<div className="ml2-before ml2-rise" style={delay(1)}>
{beforeHeading ? <h3 className="ml2-before-title">{beforeHeading}</h3> : null}
{beforeItems.length > 0 ? (
<ul className="ml2-before-list">
{beforeItems.map((item, i) => (
<li key={item} className="ml2-before-item">
<span className="ml2-x" aria-hidden="true">
<X size={14} strokeWidth={3} />
</span>
<span>
<span className="ml2-strike" style={{ ["--i" as string]: i } as React.CSSProperties}>
{item}
</span>
</span>
</li>
))}
</ul>
) : null}
{aside ? <p className="ml2-aside">{aside}</p> : null}
</div>
) : null}
{hasBefore ? <div className="ml2-rule" aria-hidden="true" /> : null}
<form
className="ml2-card ml2-rise"
style={delay(2)}
noValidate
onSubmit={handleSubmit}
aria-labelledby={ids.title}
aria-busy={busy || undefined}
>
{error ? (
<p className="ml2-alert" role="alert">
<AlertCircle className="ml2-inline-icon" size={16} strokeWidth={2.5} aria-hidden="true" />
{error}
</p>
) : null}
<label className="ml2-label" htmlFor={ids.email}>
{copy.emailLabel}
</label>
<div className="ml2-field">
<Mail className="ml2-field-icon" size={20} strokeWidth={2.5} aria-hidden="true" />
<input
id={ids.email}
className="ml2-input"
type="email"
name="email"
inputMode="email"
autoComplete="username email"
autoCapitalize="none"
spellCheck={false}
placeholder={copy.emailPlaceholder}
value={email}
onChange={(e) => setEmail(e.target.value)}
onBlur={() => {
if (email.trim()) setEmailTouched(true);
}}
disabled={locked}
readOnly={busy}
aria-invalid={shownEmailError ? true : undefined}
aria-describedby={shownEmailError ? ids.emailError : undefined}
/>
</div>
<div aria-live="polite">
{shownEmailError ? (
<p id={ids.emailError} className="ml2-msg ml2-msg--error">
<AlertCircle className="ml2-inline-icon" size={16} strokeWidth={2.5} aria-hidden="true" />
{shownEmailError}
</p>
) : null}
</div>
{allowPassword ? (
<button
type="button"
className="ml2-toggle"
onClick={toggleMethod}
disabled={locked}
aria-expanded={isPassword}
aria-controls={ids.reveal}
>
{isPassword ? (
<Mail size={16} strokeWidth={2.5} aria-hidden="true" />
) : (
<KeyRound size={16} strokeWidth={2.5} aria-hidden="true" />
)}
<span>{isPassword ? copy.useMagic : copy.usePassword}</span>
</button>
) : null}
{allowPassword ? (
<div id={ids.reveal} className="ml2-reveal" data-open={isPassword ? "true" : "false"}>
<div className="ml2-reveal-inner">
<div className="ml2-reveal-pad">
<div className="ml2-label-row">
<label className="ml2-label ml2-label--row" htmlFor={ids.password}>
{copy.passwordLabel}
</label>
{forgot}
</div>
<div className="ml2-field">
<KeyRound className="ml2-field-icon" size={20} strokeWidth={2.5} aria-hidden="true" />
<input
ref={passwordRef}
id={ids.password}
className="ml2-input ml2-input--pw"
type={reveal ? "text" : "password"}
name="password"
autoComplete="current-password"
placeholder={copy.passwordPlaceholder}
value={password}
onChange={(e) => {
passwordDirty.current = true;
setPassword(e.target.value);
}}
onBlur={() => {
setCaps(false);
if (passwordDirty.current) setPasswordTouched(true);
}}
onKeyDown={readCaps}
onKeyUp={readCaps}
disabled={locked}
readOnly={busy}
aria-invalid={shownPasswordError ? true : undefined}
aria-describedby={shownPasswordError ? ids.passwordError : undefined}
/>
<button
type="button"
className="ml2-eye"
onClick={() => setReveal((r) => !r)}
aria-label={reveal ? copy.hidePassword : copy.showPassword}
aria-controls={ids.password}
disabled={locked}
>
{reveal ? (
<EyeOff size={20} strokeWidth={2.5} aria-hidden="true" />
) : (
<Eye size={20} strokeWidth={2.5} aria-hidden="true" />
)}
</button>
</div>
<div aria-live="polite">
{caps && isPassword ? (
<p className="ml2-msg ml2-msg--caps">
<ArrowBigUp className="ml2-inline-icon" size={16} strokeWidth={2.5} aria-hidden="true" />
{copy.capsLock}
</p>
) : null}
{shownPasswordError ? (
<p id={ids.passwordError} className="ml2-msg ml2-msg--error">
<AlertCircle className="ml2-inline-icon" size={16} strokeWidth={2.5} aria-hidden="true" />
{shownPasswordError}
</p>
) : null}
</div>
</div>
</div>
</div>
) : null}
<button
type="submit"
className={ctaClass}
disabled={locked || (invalid && !busy)}
aria-disabled={busy || undefined}
aria-describedby={showNote ? ids.note : undefined}
>
{busy ? <Loader2 className="ml2-spin" size={20} strokeWidth={2.5} aria-hidden="true" /> : null}
<span key={label} className="ml2-cta-label">
{label}
</span>
</button>
{showNote ? (
<p id={ids.note} className="ml2-note">
<Mail className="ml2-inline-icon" size={16} strokeWidth={2.5} aria-hidden="true" />
{copy.magicNote}
</p>
) : null}
</form>
{signupHref ? (
<p className="ml2-foot ml2-rise" style={delay(3)}>
{copy.signupPrompt} <a href={signupHref}>{copy.signupLabel}</a>
</p>
) : null}
</div>
</div>
);
}
export default MemberLogin2;
const DEFAULT_BEFORE = [
"Guess which password you used",
"Wait for the reset email",
"Invent a new one you’ll forget",
];
const DEFAULT_COPY: MemberLogin2Copy = {
emailLabel: "Email address",
emailPlaceholder: "you@example.com",
passwordLabel: "Password",
passwordPlaceholder: "Your password",
magicAction: "Email me a sign-in link",
passwordAction: "Sign in",
magicBusy: "Sending your link…",
passwordBusy: "Signing you in…",
usePassword: "Use a password instead",
useMagic: "Use a sign-in link instead",
forgotPassword: "Forgot password?",
showPassword: "Show password",
hidePassword: "Hide password",
magicNote: "We’ll email you a one-tap link. No password to remember.",
capsLock: "Caps Lock is on",
emailRequired: "Enter your email address to get your link.",
emailInvalid: "That email looks incomplete. Try the format you@example.com.",
passwordRequired: "Enter your password to sign in.",
signupPrompt: "New here?",
signupLabel: "Create your account",
};
function isEmail(value: string) {
const at = value.indexOf("@");
if (at < 1 || at !== value.lastIndexOf("@") || value.includes(" ")) return false;
const domain = value.slice(at + 1);
const dot = domain.lastIndexOf(".");
return dot > 0 && domain.length - dot > 2;
}
function delay(step: number) {
return { ["--d" as string]: `${Math.min(step * 0.07, 0.28)}s` } as React.CSSProperties;
}
const CSS = `
.cf-member-login-2 {
position: relative;
isolation: isolate;
overflow: hidden;
container: ml2 / inline-size;
border-radius: calc(var(--radius, 12px) + 8px);
background: var(--band);
color: var(--band-ink);
font-family: var(--font-body);
font-size: clamp(1.0625rem, 1.25vw, 1.125rem);
line-height: 1.5;
padding: clamp(48px, 7vw, 96px) clamp(16px, 4vw, 48px) clamp(56px, 7.5vw, 104px);
}
.cf-member-login-2 *, .cf-member-login-2 *::before, .cf-member-login-2 *::after { box-sizing: border-box; }
.cf-member-login-2 :where(h2, h3, p, ul) { margin: 0; }
.cf-member-login-2 .ml2-scrim {
position: absolute;
inset: 0;
pointer-events: none;
background: oklch(from var(--band) l c h / 0.66);
}
.cf-member-login-2 .ml2-inner {
position: relative;
z-index: 1;
max-width: 1000px;
margin-inline: auto;
display: grid;
grid-template-columns: minmax(0, 1fr);
justify-items: center;
}
.cf-member-login-2 .ml2-before,
.cf-member-login-2 .ml2-rule { display: none; }
/* the promise */
.cf-member-login-2 .ml2-head { width: 100%; max-width: 460px; text-align: center; margin-bottom: 32px; }
.cf-member-login-2 .ml2-wordmark { display: inline-flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.cf-member-login-2 .ml2-mono {
display: grid;
place-items: center;
width: 40px;
height: 40px;
border-radius: 10px;
background: linear-gradient(oklch(from var(--accent-fill, var(--accent)) calc(l + 0.04) c h), oklch(from var(--accent-fill, var(--accent)) calc(l - 0.04) c h));
color: var(--accent-fill-ink, var(--card));
box-shadow: inset 0 1px 0 oklch(from var(--accent-fill, var(--accent)) calc(l + 0.14) c h / 0.7), 0 1px 2px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.35);
font-family: var(--font-display);
font-weight: var(--display-weight, 800);
font-size: 1.3125rem;
line-height: 1;
}
.cf-member-login-2 .ml2-brand {
font-family: var(--font-display);
font-weight: var(--display-weight, 800);
font-size: 1.375rem;
line-height: 1.15;
letter-spacing: -0.01em;
color: var(--band-ink);
}
.cf-member-login-2 .ml2-logo {
display: block;
margin: 0 auto 24px;
width: auto;
height: auto;
max-height: 40px;
max-width: 200px;
object-fit: contain;
}
.cf-member-login-2 .ml2-title {
font-family: var(--font-display);
font-weight: var(--display-weight, 800);
letter-spacing: var(--display-tracking, -0.025em);
text-transform: var(--display-case, none);
font-size: clamp(2rem, 3.6vw, 3.25rem);
line-height: 1.06;
text-wrap: balance;
color: var(--band-ink);
}
.cf-member-login-2 .ml2-lead {
margin-top: 14px;
font-size: clamp(1.125rem, 1.5vw, 1.375rem);
line-height: 1.4;
font-weight: 500;
color: color-mix(in oklch, var(--band-ink) 86%, var(--band));
text-wrap: pretty;
}
/* before: the friction, struck out */
.cf-member-login-2 .ml2-before-title {
margin-bottom: 20px;
font-family: var(--font-display);
font-weight: var(--display-weight, 800);
font-size: clamp(1.3125rem, 1.8vw, 1.625rem);
line-height: 1.15;
letter-spacing: -0.01em;
color: var(--band-ink);
text-wrap: balance;
}
.cf-member-login-2 .ml2-before-list { list-style: none; padding: 0; display: grid; gap: 16px; }
.cf-member-login-2 .ml2-before-item {
display: flex;
align-items: flex-start;
gap: 12px;
font-size: clamp(1.0625rem, 1.25vw, 1.125rem);
line-height: 1.5;
color: color-mix(in oklch, var(--band-ink) 86%, var(--band));
text-wrap: pretty;
}
.cf-member-login-2 .ml2-x {
flex: 0 0 auto;
display: grid;
place-items: center;
width: 24px;
height: 24px;
margin-top: 1px;
border-radius: 999px;
background: var(--danger);
color: var(--badge-glyph, #fff);
}
.cf-member-login-2 .ml2-strike {
background-image: linear-gradient(oklch(from var(--band-ink) l c h / 0.72), oklch(from var(--band-ink) l c h / 0.72));
background-repeat: no-repeat;
background-position: 0 58%;
background-size: 100% 2px;
-webkit-box-decoration-break: clone;
box-decoration-break: clone;
}
.cf-member-login-2 .ml2-aside {
margin-top: 24px;
font-style: italic;
font-size: clamp(1.0625rem, 1.25vw, 1.125rem);
line-height: 1.5;
color: color-mix(in oklch, var(--band-ink) 86%, var(--band));
text-wrap: pretty;
}
/* after: the one white card */
.cf-member-login-2 .ml2-card {
width: 100%;
max-width: 460px;
background: var(--card);
color: var(--ink);
border: 1px solid var(--card-border, oklch(from var(--ink) l c h / 0.12));
border-radius: var(--card-radius, var(--radius, 14px));
box-shadow: var(--card-shadow, var(--shadow-lg, 0 2px 4px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.22), 0 12px 24px -8px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.32))), inset 0 1px 0 oklch(from var(--card) calc(l + 0.04) c h / 0.6);
padding: clamp(24px, 3vw, 32px);
}
.cf-member-login-2 .ml2-alert {
margin-bottom: 20px;
padding: 12px 14px;
border-radius: 10px;
background: var(--danger-soft);
color: var(--danger);
font-size: 0.9375rem;
font-weight: 600;
line-height: 1.4;
text-wrap: pretty;
}
.cf-member-login-2 .ml2-label {
display: block;
margin-bottom: 8px;
font-size: 1.0625rem;
font-weight: 700;
line-height: 1.3;
color: var(--label-ink, var(--ink));
}
.cf-member-login-2 .ml2-label-row {
display: flex;
align-items: baseline;
justify-content: space-between;
gap: 12px;
margin-bottom: 8px;
}
.cf-member-login-2 .ml2-label--row { margin-bottom: 0; }
.cf-member-login-2 .ml2-field { position: relative; }
.cf-member-login-2 .ml2-field-icon {
position: absolute;
left: 16px;
top: 50%;
transform: translateY(-50%);
pointer-events: none;
color: color-mix(in oklch, var(--field-ink) 68%, var(--field));
}
.cf-member-login-2 .ml2-input {
display: block;
width: 100%;
height: 56px;
margin: 0;
padding: 0 16px 0 48px;
font-family: var(--font-body);
font-size: 1.0625rem;
font-weight: 500;
line-height: 1.2;
color: var(--field-ink);
background: var(--field);
border: 1px solid var(--field-border, color-mix(in oklch, var(--ink) 22%, transparent));
border-radius: var(--field-radius, var(--radius, 12px));
box-shadow: inset 0 1px 2px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.08);
transition: border-color 0.16s ease, box-shadow 0.16s ease;
-webkit-appearance: none;
appearance: none;
}
.cf-member-login-2 .ml2-input--pw { padding-right: 56px; }
.cf-member-login-2 .ml2-input::placeholder { color: color-mix(in oklch, var(--field-ink) 65%, var(--field)); opacity: 1; }
.cf-member-login-2 .ml2-input:hover:not(:disabled) { border-color: color-mix(in oklch, var(--ink) 38%, transparent); }
.cf-member-login-2 .ml2-input:focus-visible {
outline: none;
border-color: var(--field-focus, var(--accent));
box-shadow: 0 0 0 3px oklch(from var(--field-focus, var(--accent)) l c h / 0.35);
}
.cf-member-login-2 .ml2-input[aria-invalid=true] { border-color: var(--danger); }
.cf-member-login-2 .ml2-input[aria-invalid=true]:focus-visible { box-shadow: 0 0 0 3px oklch(from var(--danger) l c h / 0.3); }
.cf-member-login-2 .ml2-input:disabled { cursor: not-allowed; background: color-mix(in oklch, var(--field-ink) 5%, var(--field)); }
.cf-member-login-2 .ml2-eye {
position: absolute;
right: 6px;
top: 50%;
transform: translateY(-50%);
display: grid;
place-items: center;
width: 44px;
height: 44px;
padding: 0;
border: 0;
border-radius: calc(var(--field-radius, var(--radius, 12px)) - 4px);
background: transparent;
color: color-mix(in oklch, var(--field-ink) 68%, var(--field));
cursor: pointer;
transition: background 0.16s ease, color 0.16s ease;
}
.cf-member-login-2 .ml2-eye:hover:not(:disabled) { background: color-mix(in oklch, var(--field-ink) 7%, var(--field)); color: var(--field-ink); }
.cf-member-login-2 .ml2-eye:focus-visible { outline: 3px solid oklch(from var(--field-focus, var(--accent)) l c h / 0.5); outline-offset: -3px; }
.cf-member-login-2 .ml2-eye:disabled { cursor: not-allowed; }
.cf-member-login-2 .ml2-msg {
margin-top: 8px;
font-size: 0.9375rem;
font-weight: 600;
line-height: 1.4;
text-wrap: pretty;
}
.cf-member-login-2 .ml2-msg--error { color: var(--danger); }
.cf-member-login-2 .ml2-msg--caps { color: var(--warning); }
.cf-member-login-2 .ml2-inline-icon { display: inline-block; vertical-align: -0.15em; margin-inline-end: 0.4em; }
/* the toggle: password one tap away */
.cf-member-login-2 .ml2-toggle {
display: inline-flex;
align-items: center;
gap: 8px;
min-height: 44px;
margin-top: 4px;
padding: 0 2px;
border: 0;
border-radius: 6px;
background: none;
font-family: var(--font-body);
font-size: 0.9375rem;
font-weight: 700;
line-height: 1.3;
color: var(--link, var(--accent));
cursor: pointer;
text-decoration: underline;
text-decoration-color: oklch(from var(--link, var(--accent)) l c h / 0.45);
text-underline-offset: 0.18em;
transition: color 0.16s ease;
}
.cf-member-login-2 .ml2-toggle:hover:not(:disabled) { color: oklch(from var(--link, var(--accent)) calc(l - 0.08) c h); text-decoration-color: currentColor; }
.cf-member-login-2 .ml2-toggle:focus-visible,
.cf-member-login-2 .ml2-link:focus-visible { outline: 3px solid oklch(from var(--field-focus, var(--accent)) l c h / 0.5); outline-offset: 2px; }
.cf-member-login-2 .ml2-toggle:disabled { color: var(--muted); cursor: not-allowed; text-decoration-color: transparent; }
.cf-member-login-2 .ml2-link {
padding: 10px 0;
margin: -10px 0;
border: 0;
border-radius: 4px;
background: none;
font-family: var(--font-body);
font-size: 0.9375rem;
font-weight: 700;
line-height: 1.3;
white-space: nowrap;
color: var(--link, var(--accent));
cursor: pointer;
text-decoration: underline;
text-decoration-color: oklch(from var(--link, var(--accent)) l c h / 0.45);
text-underline-offset: 0.18em;
}
.cf-member-login-2 .ml2-link:hover { color: oklch(from var(--link, var(--accent)) calc(l - 0.08) c h); text-decoration-color: currentColor; }
.cf-member-login-2 .ml2-reveal {
display: grid;
grid-template-rows: 0fr;
transition: grid-template-rows 0.32s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.cf-member-login-2 .ml2-reveal[data-open=true] { grid-template-rows: 1fr; }
.cf-member-login-2 .ml2-reveal-inner {
min-height: 0;
overflow: hidden;
margin-inline: -4px;
visibility: hidden;
opacity: 0;
transform: translateY(-6px);
transition: opacity 0.22s ease, transform 0.32s cubic-bezier(0.2, 0.7, 0.2, 1), visibility 0s linear 0.32s;
}
.cf-member-login-2 .ml2-reveal[data-open=true] .ml2-reveal-inner {
visibility: visible;
opacity: 1;
transform: none;
transition: opacity 0.28s ease 0.06s, transform 0.32s cubic-bezier(0.2, 0.7, 0.2, 1), visibility 0s;
}
.cf-member-login-2 .ml2-reveal-pad { padding: 12px 4px 4px; }
/* the action */
.cf-member-login-2 .ml2-cta {
--ml2-bg: var(--button-bg, var(--cta));
--ml2-bg2: var(--button-bg-2, var(--cta-2));
display: inline-flex;
align-items: center;
justify-content: center;
gap: 10px;
width: 100%;
min-height: 56px;
margin-top: 24px;
padding: 0 24px;
border: 0;
border-radius: var(--button-radius, var(--radius, 12px));
background: linear-gradient(oklch(from var(--ml2-bg) calc(l + 0.04) c h), oklch(from var(--ml2-bg2) calc(l - 0.02) c h));
color: var(--button-ink, var(--cta-ink));
font-family: var(--button-font, var(--font-display));
font-weight: var(--button-weight, 800);
font-size: clamp(1.125rem, 1.55vw, 1.375rem);
line-height: 1.15;
text-transform: var(--button-case, none);
text-shadow: var(--button-text-shadow, none);
box-shadow: var(--button-shadow, inset 0 1px 0 oklch(from var(--ml2-bg) calc(l + 0.14) c h / 0.7), inset 0 -3px 0 oklch(from var(--ml2-bg) calc(l - 0.16) c h), 0 1px 2px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.35), 0 8px 16px -6px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.5));
cursor: pointer;
transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}
.cf-member-login-2 .ml2-cta:not(:disabled):hover,
.cf-member-login-2 .ml2-cta.is-hover:not(:disabled) {
background: linear-gradient(oklch(from var(--ml2-bg) calc(l - 0.01) c h), oklch(from var(--ml2-bg2) calc(l - 0.07) c h));
box-shadow: inset 0 1px 0 oklch(from var(--ml2-bg) calc(l + 0.12) c h / 0.7), inset 0 -3px 0 oklch(from var(--ml2-bg) calc(l - 0.2) c h), 0 1px 2px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.4), 0 10px 20px -6px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.58);
}
.cf-member-login-2 .ml2-cta:not(:disabled):active,
.cf-member-login-2 .ml2-cta.is-active:not(:disabled) {
transform: translateY(1px);
background: linear-gradient(oklch(from var(--ml2-bg) calc(l - 0.05) c h), oklch(from var(--ml2-bg2) calc(l - 0.09) c h));
box-shadow: inset 0 2px 4px oklch(from var(--ml2-bg) calc(l - 0.22) c h / 0.55), inset 0 -2px 0 oklch(from var(--ml2-bg) calc(l - 0.18) c h), 0 1px 1px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.35);
}
.cf-member-login-2 .ml2-cta:focus-visible { outline: 3px solid oklch(from var(--field-focus, var(--accent)) l c h / 0.55); outline-offset: 3px; }
.cf-member-login-2 .ml2-cta:disabled {
background: var(--secondary);
color: var(--secondary-ink);
text-shadow: none;
box-shadow: none;
cursor: not-allowed;
}
.cf-member-login-2 .ml2-cta.is-busy { cursor: progress; }
.cf-member-login-2 .ml2-cta-label { display: inline-block; }
.cf-member-login-2 .ml2-note {
margin-top: 12px;
text-align: center;
font-size: 0.9375rem;
font-weight: 500;
line-height: 1.4;
color: var(--muted);
text-wrap: pretty;
}
.cf-member-login-2 .ml2-foot {
width: 100%;
max-width: 460px;
margin-top: 24px;
text-align: center;
font-size: 0.9375rem;
font-weight: 500;
line-height: 1.4;
color: color-mix(in oklch, var(--band-ink) 86%, var(--band));
}
.cf-member-login-2 .ml2-foot a {
color: var(--band-ink);
font-weight: 700;
text-decoration: underline;
text-decoration-color: oklch(from var(--band-ink) l c h / 0.5);
text-underline-offset: 0.18em;
}
.cf-member-login-2 .ml2-foot a:hover { text-decoration-color: currentColor; }
.cf-member-login-2 .ml2-foot a:focus-visible { outline: 3px solid oklch(from var(--band-ink) l c h / 0.6); outline-offset: 2px; border-radius: 4px; }
/* wide: the before column beside the after card */
@container ml2 (min-width: 940px) {
.cf-member-login-2 .ml2-inner:not(.ml2-inner--solo) {
grid-template-columns: minmax(0, 1fr) 1px minmax(0, 460px);
grid-template-areas: ". . head" "before rule card" ". . foot";
column-gap: clamp(40px, 5cqi, 72px);
align-items: start;
}
.cf-member-login-2 .ml2-inner:not(.ml2-inner--solo) .ml2-head { grid-area: head; }
.cf-member-login-2 .ml2-inner:not(.ml2-inner--solo) .ml2-card { grid-area: card; }
.cf-member-login-2 .ml2-inner:not(.ml2-inner--solo) .ml2-foot { grid-area: foot; }
.cf-member-login-2 .ml2-before {
display: block;
grid-area: before;
justify-self: end;
width: 100%;
max-width: 360px;
padding-top: 12px;
}
.cf-member-login-2 .ml2-rule {
display: block;
grid-area: rule;
align-self: stretch;
width: 1px;
background: oklch(from var(--band-ink) l c h / 0.18);
}
}
@media (prefers-reduced-motion: no-preference) {
.cf-member-login-2 .ml2-rise { animation: ml2-rise 0.45s cubic-bezier(0.2, 0.7, 0.2, 1) both; animation-delay: var(--d, 0s); }
.cf-member-login-2 .ml2-strike { animation: ml2-strike 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) both; animation-delay: calc(0.4s + var(--i, 0) * 0.14s); }
.cf-member-login-2 .ml2-cta-label { animation: ml2-swap 0.3s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.cf-member-login-2 .ml2-spin { animation: ml2-spin 0.8s linear infinite; }
}
@media (prefers-reduced-motion: reduce) {
.cf-member-login-2 .ml2-reveal,
.cf-member-login-2 .ml2-reveal-inner,
.cf-member-login-2 .ml2-reveal[data-open=true] .ml2-reveal-inner,
.cf-member-login-2 .ml2-cta,
.cf-member-login-2 .ml2-input,
.cf-member-login-2 .ml2-eye,
.cf-member-login-2 .ml2-toggle { transition: none; }
.cf-member-login-2 .ml2-reveal-inner { transform: none; }
}
@keyframes ml2-rise { from { opacity: 0.82; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes ml2-strike { from { background-size: 0% 2px; } to { background-size: 100% 2px; } }
@keyframes ml2-swap { from { opacity: 0.4; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes ml2-spin { to { transform: rotate(360deg); } }
`;
pieces/forms/member-login-2/specimen.tsx 36 lines
import * as React from "react";
import { MemberLogin2 } from "../member-login-2";
import defaults from "../../studio-defaults.json";
import { slot } from "../../slots";
export const states = ["default", "hover", "active", "disabled", "error"];
type SpecimenState = "default" | "hover" | "active" | "disabled" | "error";
const EMAIL_LABEL = defaults.sample.fields.find((f) => f.name === "email")?.label ?? "Email address";
export default function MemberLogin2Specimen({ state = "default" }: { state?: SpecimenState }) {
const remembered = state === "disabled" ? "" : state === "error" ? "dana@briefcase" : "dana@example.com";
const logo = slot("logo", "");
return (
<MemberLogin2
key={state}
state={state}
brandName="Briefcase"
logoImage={logo || undefined}
logoAlt="Briefcase"
lead="Your drafts are right where you left them. One email gets you back in."
beforeHeading="Skip the password reset loop"
beforeItems={[
"Guess which password you used",
"Wait for the reset email",
"Invent a new one you’ll forget",
]}
aside="(I’ve done it more times than I’d admit. That’s why the link comes first.)"
defaultEmail={remembered}
forgotHref="#forgot-password"
signupHref="#create-account"
copy={{ emailLabel: EMAIL_LABEL, signupPrompt: "New to Briefcase?" }}
/>
);
}
| Name | Type | Details |
|---|---|---|
brandName OptionalMemberLogin2 |
string |
|
logoImage OptionalMemberLogin2 |
string |
|
logoAlt OptionalMemberLogin2 |
string |
|
headline OptionalMemberLogin2 |
React.ReactNode |
|
lead OptionalMemberLogin2 |
React.ReactNode |
|
beforeHeading OptionalMemberLogin2 |
React.ReactNode |
|
beforeItems OptionalMemberLogin2 |
string[] |
|
aside OptionalMemberLogin2 |
React.ReactNode |
|
backdropImage OptionalMemberLogin2 |
string |
|
defaultEmail OptionalMemberLogin2 |
string |
|
defaultMethod OptionalMemberLogin2 |
MemberLogin2Method |
|
allowPassword OptionalMemberLogin2 |
boolean |
|
forgotHref OptionalMemberLogin2 |
string |
|
signupHref OptionalMemberLogin2 |
string |
|
error OptionalMemberLogin2 |
string |
|
busy OptionalMemberLogin2 |
boolean |
|
disabled OptionalMemberLogin2 |
boolean |
|
state OptionalMemberLogin2 |
"default" | "hover" | "active" | "disabled" | "error" |
|
onSubmit OptionalMemberLogin2 |
(values: MemberLogin2Values) => void |
|
onForgotPassword OptionalMemberLogin2 |
(email: string) => void |
|
onMethodChange OptionalMemberLogin2 |
(method: MemberLogin2Method) => void |
|
copy OptionalMemberLogin2 |
Partial<MemberLogin2Copy> |
|
className OptionalMemberLogin2 |
string |
Theme roles it reads
Set by the theme bar, a preset or your brand. Colours come from the base tokens (--surface, --ink, --cta…) every piece uses.
--button-bg--button-bg-2--button-case--button-font--button-ink--button-radius--button-shadow--button-text-shadow--button-weight- Main CTA button: background, ink, font, weight, case, radius and shadow.
--card-border--card-radius--card-shadow- Cards and panels: radius, border and shadow.
--display-case--display-tracking--display-weight- Headlines: weight, letter case and tracking.
--field--field-border--field-focus--field-ink--field-radius- Form inputs: background, ink, border, radius and focus colour.
Image slots
Filled from the brand’s images; the specimen ships its own defaults.
logo- The brand’s logo mark.
-
7ef109748b828d4d.webp
image/webp · 22.2 KB
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB