Staaarter

Pattern Lock Unlock

Full-height pattern-unlock screen with a 3x3 grid of tappable dots. Clicking dots in sequence adds them to a selection array and draws connecting lines between consecutively selected dots, with Clear and Unlock actions.

By Staaarter Team
Auth
Docs
Live preview

Docs

Installation

A real shadcn registry command, not a copy-paste stand-in: it fetches this block plus its button dependencies and any missing npm packages, and installs them straight into your project.

npx shadcn add https://staaarter.com/r/pattern-lock-unlock.json

Prefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/auth/auth38.tsx instead.

Usage

The file also exports auth38Demo, the exact props behind the preview above. Spread it to get a working section in one line, then replace it with your own data.

import { Auth38, auth38Demo } from "@/components/blocks/auth/auth38";

export default function Page() {
  return <Auth38 {...auth38Demo} />;
}

Props

PropTypeDefaultDescription
headingstring"Draw your pattern"Screen heading above the dot grid.
descriptionstringundefinedShort instruction text below the heading.
minimumDotsnumber4Minimum number of selected dots required before the Unlock button becomes enabled.
classNamestringnoneExtra classes for the outer section element.

Behavior notes

  • Real client-side state: clicking a dot appends its index to a `selectedDots` array in click order, ignoring a dot that is already selected; the grid has no drag/pointer-move drawing, only discrete clicks.
  • Connecting lines are drawn with an absolutely positioned SVG overlay, one <line> per consecutive pair in `selectedDots`, using fixed 3x3 grid coordinates (20/50/80 on each axis) computed from each dot's row/column index.
  • 'Clear' resets `selectedDots` to an empty array. 'Unlock' is disabled until `selectedDots.length >= minimumDots`; clicking it has no real effect, there is no backend to unlock against.
  • A visually-hidden live region announces the running selection count for screen reader users, and each dot has an aria-label identifying its position and, once selected, its step order.