Viewfinder
The signature: four purple camera corners around one piece of media. Once per page.
northwind.io
Install
$ npx shadcn@latest add @nudgekit/viewfinderOr with no config: npx shadcn@latest add https://ui.nudgekit.app/r/viewfinder.json
Usage
usage.tsx
import { Viewfinder } from "@/components/viewfinder"
<Viewfinder>
<BrowserFrame url="northwind.io">…</BrowserFrame>
</Viewfinder>Do
- Use it once per page, around the hero media.
Don't
- Put corners on cards, images or buttons elsewhere.
Code
What the CLI writes into your project. It is yours to change.
components/viewfinder.tsx
import * as React from "react";
import { cn } from "@/lib/utils";
/**
* The NudgeKit signature: four brand-coloured camera corners around one piece of media.
* Use it once per page, on the hero media.
*/
function Viewfinder({ className, children, ...props }: React.HTMLAttributes<HTMLDivElement>) {
const corner = "pointer-events-none absolute size-[22px] border-brand";
return (
<div data-slot="viewfinder" className={cn("relative p-3.5", className)} {...props}>
<span aria-hidden className={cn(corner, "left-0 top-0 rounded-tl-lg border-l-2 border-t-2")} />
<span aria-hidden className={cn(corner, "right-0 top-0 rounded-tr-lg border-r-2 border-t-2")} />
<span aria-hidden className={cn(corner, "bottom-0 left-0 rounded-bl-lg border-b-2 border-l-2")} />
<span aria-hidden className={cn(corner, "bottom-0 right-0 rounded-br-lg border-b-2 border-r-2")} />
{children}
</div>
);
}
export { Viewfinder };