05 / Controls
Impossible Checkbox
A checkbox with one stubborn rule: the bear will not let you leave it on. Best kept for demos, Easter eggs, and harmless preferences.
"use client"
import { ImpossibleCheckbox } from "mischief-ui/impossible-checkbox"
export function ImpossibleCheckboxDemo() {
return (
<ImpossibleCheckbox className="bg-[#947cb0] [--impossible-bear:#784421] [--impossible-features:#16110e] [--impossible-muzzle:#e9c6af]" />
)
}Installation
Copy the source into your project, or keep it behind a package.
npx shadcn@latest add Tinkerers-Labs/mischief-ui/impossible-checkboximport { ImpossibleCheckbox } from "mischief-ui/impossible-checkbox"Or paste it in yourself. The source imports the shared cn helper from @/lib/utils, so point that at your own copy.
"use client" import * as React from "react"import { motion, useAnimationControls, useReducedMotion } from "motion/react"import { cn } from "@/lib/utils" export interface ImpossibleCheckboxProps extends Omit< React.InputHTMLAttributes<HTMLInputElement>, "checked" | "defaultChecked" | "onChange" | "type"> { onAttempt?: (attempt: number) => void revealAfter?: number angryAfter?: number className?: stringUsage
export function Demo() {
return (
<ImpossibleCheckbox
aria-label="Enable bear mode"
onAttempt={(attempt) => console.log({ attempt })}
/>
)
}Do not use this for anything that matters
This is a joke. A paw reaches out and unchecks the box, and it keeps doing it until you have tried enough times. It is genuinely funny once, and it is genuinely infuriating if it stands between someone and something they need.
So: never for consent, terms, permissions, a privacy choice, or anything a form submits. Anything a person must be able to set, they must be able to set on the first try. A 404 page, an easter egg, a demo, a settings toggle for something that does not exist -- those are where it belongs.
revealAfter and angryAfter decide how long the bit runs before it gives up and lets the box stay checked. Keep them low if there is any chance someone actually wanted the checkbox.
Following along
onAttempt fires with a running count each time someone tries, which is what you would build the rest of the joke around -- a line of copy that escalates, a sound, a message that gives in before the paw does.
<ImpossibleCheckbox
angryAfter={3}
revealAfter={5}
onAttempt={(attempt) => setTaunt(taunts[attempt] ?? taunts.at(-1))}
/>Motion is an optional peer and drives the whole performance. With reduced motion the animation collapses to nothing, so consider whether the joke still lands for that reader, and offer them the plain checkbox instead.
API
onAttempt(attempt: number) => voidRuns each time someone tries to check it.revealAfternumberAttempts before the bear starts peeking. Defaults to 2.angryAfternumberAttempts before the bear looks angry. Defaults to 5.classNamestringClasses and custom properties for the frame....inputPropsInputHTMLAttributesNative checkbox attributes except checked and onChange.Accessibility
The control is a native checkbox and works with pointer, touch, and keyboard input. A polite live region explains that the bear switched it off. Reduced motion skips the swat sequence while keeping the result clear. Do not use it for consent, safety, or any setting a person genuinely needs to change.