Secret field
API key field hidden under crawling pixel noise; holding the eye wipes the noise away and each character decodes before it locks.
Your data
Pass your key as value. Without it the field shows a fake demo key. See Your data.
Playground
Change a prop and the component updates. Props marked live animate to the new value; the others rebuild the element.
<PxSecret value="sk-demo-4f9Q7xLm2Rk8Vt3nW6pA" />
Installation
pnpm dlx shadcn@latest add @lumesec/px-secretFirst timeRegister the @lumesec registry once, or install by URL
Adds @lumesec to your components.json:
pnpm dlx shadcn@latest registry add @lumesec=https://elements.lumesec.ai/r/{name}.jsonOr skip the setup and install by URL:
npx shadcn@latest add https://elements.lumesec.ai/r/px-secret.jsonUsage
import { PxSecret } from "@/components/lumesec/px-secret";
export function Example() {
return (
<PxSecret />
);
}Behaviour
The key hides under crawling pixel noise. Holding the eye wipes the noise away behind a dithered edge while each character decodes through random glyphs before it locks. Let go and it scrambles shut. The key shown is a fake.
API reference
Attributes
valueReact propvalueTypestringDefaultsk-demo-4f9Q7xLm2Rk8Vt3nW6pAThe key to display and copy. Changing it rebuilds the characters; the copy button reads the attribute at click time.
Properties
valueTypestringThe key to display and copy; reflects the value attribute, or the demo key when it is missing.
Keyboard
| Keys | Action |
|---|---|
| Space / Enter (on the eye button) | Reveal while held; releasing the key or moving focus away hides it again. |
Accessibility
- The eye button has
aria-label="Hold to reveal the key"andaria-pressedreflecting whether it is held. - The copy button has
aria-label="Copy the key". - The key container is a
role="group"witharia-label="API key, hidden", which changes to include the key once it is fully revealed. The characters and the noise arearia-hidden, and hidden characters are not rendered, so the key cannot be read or selected before it is revealed. - The hint line below is an
aria-live="polite"region that reports copy success or failure. - Reduced motion: the key reveals and hides at once, characters appear without the scramble and the noise layer holds still.
Theming
The element reads your shadcn theme tokens through its shadow root, so light and dark follow your theme. The accent comes from --lumesec. See Theming.
This component reads --border, --card, --foreground, --lumesec and --muted-foreground.
To restyle only LumeSec elements, set the matching --ui-* overrides: --ui-accent, --ui-border, --ui-fg, --ui-mono, --ui-muted and --ui-surface.
Notes
- The default value is a fake demo key. The key is part of the page: it is hidden from view, not encrypted.
- Copy uses
navigator.clipboard.writeText; when that is unavailable the hint asks the user to reveal and copy by hand. - The key stays visible for 0.35 seconds after release before it scrambles shut. The label text "API key" is fixed.
Related
Was this page helpful?