Skip to content

React Lamp Login

A dark stage with a pull cord: pull it and a warm light cone reveals a glass sign-in card. The card is always there for keyboards and screen readers.

npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/lamp-login.json

Pull the cord to switch the light on

Welcome back

Sign in to continue to your workspace.

New here? Create an account

Pull the cord

Click the bead, press Enter or Space on it, or drag it down on a touch screen. Tabbing into the card also switches the light on. With reduced motion the light starts on.

Pull the cord to switch the light on

Welcome back

Sign in to continue to your workspace.

New here? Create an account

Files to copy

10 folders · 17 files · 4 packages
From theme/src/
  • blocks/{lamp-login.tsx, glass-login.tsx, icons.tsx}
  • components/button/
  • components/glass-card/
  • components/input/
  • components/spinner/
  • components/status-icons/
  • hooks/{use-controllable.ts, use-latest.ts, use-magnetic.ts, use-media-query.ts, use-preferences.ts}
  • motion/{gate.ts, light-follower.ts, tokens.ts}
  • lib/{cn.ts, field-size.ts, form.ts, heading.ts, state-light.tsx, warn-once.ts}
  • styles/
shadcn CLI
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/lamp-login.jsonRegistry item: lamp-login. The styles need the Tailwind v4 glass UI setup.
Packages
pnpm add @base-ui/react clsx motion tailwind-merge

Starts lit, with social buttons

defaultLit starts with the light on; onLitChange reports every switch. onSocial and the other GlassLogin options pass straight through.

Pull the cord to switch it off

Back in the studio

Sign in to pick up where you left off.

or continue with

New here? Create an account

Props

PropTypeDefaultDescription
litbooleanNoneControls whether the light is on (boolean). Use with onLitChange; leave it out to let the block keep the state.
defaultLitbooleanfalseThe light's starting state when uncontrolled (boolean, default false; with reduced motion the light starts on).
onLitChange((lit: boolean) => void)NoneCalled when the light is switched by the cord, or by focus entering the card ((lit: boolean) => void).
titleReactNode"Welcome back"Sets the card heading (ReactNode, default "Welcome back").
subtitleReactNode"Sign in to continue to your workspace."The line under the heading (ReactNode, default "Sign in to continue to your workspace.").
onSubmit((values: GlassLoginValues) => void | Promise<void>)NoneCalled with the form values. Return a promise to show a loading state; throw to show an error.
onSocial((provider: "github" | "google") => void)NoneShow "Continue with GitHub / Google" buttons. Without it the social row is hidden.
forgotHrefstring"#"Target of the "Forgot password?" link (string, default "#").
signUpHrefstring | null"#"Target of the sign-up link (string | null, default "#"). Hide the sign-up line by passing null.
minPasswordLengthnumber8Minimum password length checked before submitting (number, default 8).
loginLabelsPartial<GlassLoginLabels>defaultGlassLoginLabelsEvery other string, for translation: loginLabels={{ email: "…" }}; omitted keys keep the English of defaultGlassLoginLabels. All 15 keys of GlassLoginLabels are listed in the key table under the props table.
labelsPartial<LampLoginLabels>defaultLampLoginLabelsEvery other string, for translation: labels={{ cord: "…" }}; omitted keys keep the English of defaultLampLoginLabels. All 3 keys of LampLoginLabels are listed in the key table under the props table.
headingLevelHeadingLevelOption2Level of the card heading (1 to 6). "none" renders a paragraph with no heading role (for an example).
classNamestringNoneAdds extra classes to the stage (string).
GlassLoginLabels keys and English defaults (15)
Pass any key in loginLabels; the rest keep the defaults of defaultGlassLoginLabels.
KeyEnglish default
emailEmail
emailPlaceholderyou@example.com
passwordPassword
showPasswordShow password
hidePasswordHide password
forgotForgot password?
submitSign in
divideror continue with
githubGitHub
googleGoogle
signUpPromptNew here?
signUpCreate an account
invalidEmailEnter a valid email address.
shortPassword(min) => `Password must be at least ${min} characters.`
genericErrorSomething went wrong. Try again.
LampLoginLabels keys and English defaults (3)
Pass any key in labels; the rest keep the defaults of defaultLampLoginLabels.
KeyEnglish default
cordLamp light
hintOffPull the cord to switch the light on
hintOnPull the cord to switch it off

Keyboard

KeysAction
TabThe cord first, then the card's fields, links and buttons in order.
Enter/Spaceon the cordPull it: switch the light on or off.
Drag the cord downOn touch: past about 24 px counts as a pull.
Focus into the cardSwitches the light on, so nobody types into the dark.

Accessibility

  • The cord is a real toggle button named by labels.cord; its pressed state says whether the light is on. The hint under the lamp is text.
  • The card is always in the page and in tab order. The lamp, cone and dimming layer are aria-hidden: nothing is said by light alone.
  • The stage is forced dark, so the glass and its text keep at least 4.5:1 contrast whatever the page theme.
  • Reduced motion: the light starts on, the cord does not swing and the cone does not grow; pulling it still changes the light with a short fade.

All exports on this page

  • LampLogin — A sign-in card on a dark stage: a lamp with a pull cord.
  • defaultLampLoginLabels — The English LampLoginLabels used when labels is omitted; a partial labels prop is merged over it.

When to use the lamp login form

  • Use LampLogin as an animated login page for a product that wants one memorable first impression: a dark stage, a lamp with a pull cord, and a sign-in card that the light reveals.
  • Use it for a portfolio, a game or a creative tool where the sign-in screen is part of the brand, and the form itself still needs real validation, a loading state and error messages.
  • Use lit, defaultLit and onLitChange when the surrounding page needs to know whether the light is on, for example to start the stage already lit after a failed sign-in.
  • Skip it for a plain admin sign-in where speed matters more than delight; GlassLogin is the same form without the stage.
  • Pair it with GlassLogin options such as onSocial and forgotHref, which it passes straight through, and with useSheenReducedMotion if you add motion of your own around it.

Frequently asked questions

20 blocks pages in all: browse them on All blocks.

By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .