FreeMIT License

Rapport — Contacts App & CRM for React, shadcn/ui & Tailwind (Address Book UI)

A complete contacts manager for React and shadcn/ui: folders and labels, highlighted search, filters, list, grid and table views, details, activity and notes, validated forms with photo crop, bulk actions with Undo, CSV and vCard import/export. Light and dark, phone to desktop.

by UpFork, built by Ramin ValadanComponentUpdated 5 Nov 2026

Read how it was madeBehind the build6 lessons
Watch1
Preview of Rapport — Contacts App & CRM for React, shadcn/ui & Tailwind (Address Book UI)

Code

48 files · 11 packages · 35 assets

"use client"

import * as React from "react"
import Cropper, { type Area } from "react-easy-crop"
import { CameraIcon, UserPlusIcon, XIcon, ZoomInIcon, ZoomOutIcon } from "lucide-react"
import { toast } from "sonner"
import { Button } from "@/components/contacts/ui/button"
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "@/components/contacts/ui/dialog"
import { Slider } from "@/components/contacts/ui/slider"
import { cn } from "@/lib/utils"
import { ContactAvatar } from "./bits"

const MAX_BYTES = 10 * 1024 * 1024

/** The crop as a 256 × 256 WebP data URL (JPEG where WebP can't be written). */
async function cropToDataUrl(src: string, area: Area) {
	const img = new Image()
	img.src = src
	await img.decode()
	const canvas = document.createElement("canvas")
	canvas.width = 256
	canvas.height = 256
	const ctx = canvas.getContext("2d")!
	ctx.imageSmoothingQuality = "high"
	ctx.drawImage(img, area.x, area.y, area.width, area.height, 0, 0, 256, 256)
	const webp = canvas.toDataURL("image/webp", 0.85)
	return webp.startsWith("data:image/webp") ? webp : canvas.toDataURL("image/jpeg", 0.88)
}

/**
 * Click or drop a picture, crop it to a circle, keep or remove it. Without a photo: initials (or "Add" on a new,
 * nameless contact) with a camera.
 */
export function AvatarUploader({ value, onChange, firstName, lastName }: { value: string; onChange: (v: string) => void; firstName: string; lastName: string }) {
	const inputRef = React.useRef<HTMLInputElement>(null)
	const [source, setSource] = React.useState<string | null>(null)
	const [crop, setCrop] = React.useState({ x: 0, y: 0 })
	const [zoom, setZoom] = React.useState(1)
	const [area, setArea] = React.useState<Area | null>(null)
	const [over, setOver] = React.useState(false)
	const named = !!(firstName.trim() || lastName.trim())

	const take = (file: File | undefined) => {
		if (!file) return
		if (!file.type.startsWith("image/")) return toast.error("Choose an image file (JPG, PNG, WebP…)")
		if (file.size > MAX_BYTES) return toast.error("That picture is over 10 MB")
		const reader = new FileReader()
		reader.onload = () => {
			setCrop({ x: 0, y: 0 })
			setZoom(1)
			setSource(String(reader.result))
		}
		reader.readAsDataURL(file)
	}

	return (
		<div className="flex items-center gap-4">
			<div className="relative">
				<button
					type="button"
					aria-label={value ? "Change photo" : "Add a photo"}
					onClick={() => inputRef.current?.click()}
					onDragOver={(e) => {
						e.preventDefault()
						setOver(true)
					}}
					onDragLeave={() => setOver(false)}
					onDrop={(e) => {
						e.preventDefault()
						setOver(false)
						take(e.dataTransfer.files[0])
					}}
					className={cn(
						"group/avatar relative flex size-20 items-center justify-center overflow-hidden rounded-full outline-none focus-visible:ring-3 focus-visible:ring-ring/50",
						over && "ring-2 ring-foreground ring-offset-2 ring-offset-card"
					)}
				>
					{value || named ? (
						<ContactAvatar person={{ firstName, lastName, avatar: value }} size={80} />
					) : (
						<span className="flex size-20 flex-col items-center justify-center gap-0.5 rounded-full border border-dashed border-muted-foreground/40 bg-muted text-xs font-medium text-foreground/65">
							<UserPlusIcon className="size-5" />
							Add
						</span>
					)}
					{value && (
						<span className="absolute inset-0 flex flex-col items-center justify-center gap-0.5 rounded-full bg-black/55 text-[11px] font-medium text-white opacity-0 transition-opacity duration-150 group-hover/avatar:opacity-100 group-focus-visible/avatar:opacity-100 pointer-coarse:opacity-60">
							<CameraIcon className="size-4" />
							Edit
						</span>
					)}
				</button>
				{!value && named && (
					<span aria-hidden className="pointer-events-none absolute -right-0.5 -bottom-0.5 flex size-7 items-center justify-center rounded-full border bg-background text-muted-foreground shadow-sm">
						<CameraIcon className="size-3.5" />
					</span>
				)}
				{value && (
					<button
						type="button"
						aria-label="Remove photo"
						onClick={() => onChange("")}
						className="absolute -top-0.5 -right-0.5 flex size-6 items-center justify-center rounded-full border bg-background text-muted-foreground shadow-sm outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring pointer-coarse:size-8"
					>
						<XIcon className="size-3.5" />
					</button>
				)}
			</div>
			<div className="min-w-0 text-[13px] text-muted-foreground">
				<p className="font-medium text-foreground">Profile photo</p>
				<p>Click or drop a picture. You can crop it next.</p>
			</div>
			<input
				ref={inputRef}
				type="file"
				accept="image/*"
				className="sr-only"
				tabIndex={-1}
				aria-hidden
				onChange={(e) => {
					const file = e.target.files?.[0]
					e.target.value = ""
					take(file)
				}}
			/>

			<Dialog open={!!source} onOpenChange={(o) => !o && setSource(null)}>
				<DialogContent className="gap-4 sm:max-w-md" showCloseButton={false}>
					<DialogHeader>
						<DialogTitle>Crop photo</DialogTitle>
						<DialogDescription>Drag to move, scroll or use the slider to zoom.</DialogDescription>
					</DialogHeader>
					<div className="relative h-72 overflow-hidden rounded-lg bg-muted">
						{source && (
							<Cropper
								image={source}
								crop={crop}
								zoom={zoom}
								aspect={1}
								cropShape="round"
								showGrid={false}
								onCropChange={setCrop}
								onZoomChange={setZoom}
								onCropComplete={(_, px) => setArea(px)}
							/>
						)}
					</div>
					<div className="flex items-center gap-3">
						<ZoomOutIcon aria-hidden className="size-4 text-muted-foreground" />
						<Slider aria-label="Zoom" min={1} max={3} step={0.01} value={[zoom]} onValueChange={(v) => setZoom(Array.isArray(v) ? v[0] : v)} />
						<ZoomInIcon aria-hidden className="size-4 text-muted-foreground" />
					</div>
					<DialogFooter>
						<Button variant="outline" onClick={() => setSource(null)}>
							Cancel
						</Button>
						<Button
							onClick={async () => {
								if (!source || !area) return
								onChange(await cropToDataUrl(source, area))
								setSource(null)
							}}
						>
							Use photo
						</Button>
					</DialogFooter>
				</DialogContent>
			</Dialog>
		</div>
	)
}
48 files35 assets11 packages

From the workbench

Written about Rapport — Contacts App & CRM for React, shadcn/ui & Tailwind (Address Book UI)

By the developer who built it: how it works, with its real code and live preview in the text, and the lessons learned along the way.

About

A complete contacts and light-CRM screen (the dashboard's /apps/contact) built on shadcn/ui with Base UI primitives, Tailwind CSS 4, zustand, react-hook-form + zod, libphonenumber-js, react-easy-crop, motion and sonner. shadcn's neutral palette only (plus six label dots), light and dark, phone to wide desktop.

npm install
npm run dev                        # http://localhost:5501
npm run build && npm run start     # review build on http://localhost:5500
import { Contacts } from "@/components/contacts/contacts"

<Contacts />                                        // the demo address book (33 people)
<Contacts contacts={mine} labels={myLabels} links={{ email: (c) => `/apps/mail?compose=${c.email}` }} />

Mount one sonner <Toaster /> in your app (as app/layout.tsx does): every change shows a toast with Undo.

What is in it

  • Sidebar: New Contact, All Contacts / Favourites / Spam / Blocked and six labels with live counts (they follow the filters), an active bar, collapsible labels, New label (name + one of the six hues), a ⋮ per label (Rename, Change color, Delete label), Import and Export. A sheet behind "Open navigation" on narrow screens.
  • Toolbar: search (/, debounced, clear button) across name, e-mail, phone digits, city, company and notes with the match highlighted; Sorted A-Z / Z-A plus Name, Recently added, City and Status; a Filter popover (status, labels with any / all, city, date added, has phone, is favourite) with a count badge; List / Grid / Table; select mode. Under it, a removable chip for every filter, Clear all and "12 of 25 contacts".
  • List: sticky A–Z groups with counts, an A–Z rail (press or drag), rows with photo, name, favourite star, a "New" badge (added in the last 30 days), the full e-mail (or the matched note, company or phone), status (solid, hollow or dashed dot and the word), up to two label chips and "+N" with the rest in a tooltip, hover quick actions (Call, Email, Message, Favourite), a ⋮ menu and the same right-click menu. Phone and city columns when the list is wide; avatar, name, status and label dots on phones.
  • Grid: cards with a neutral cover, the photo over it, status, e-mail, chips, Call / Email / Message, a star and ⋮. 1 to 4 columns by width.
  • Table: select, Name, Email, Phone, City, Labels, Status, Added on, Favourite; sortable headers, column visibility and density (View). It takes the whole width; details open in a sheet.
  • Menus by folder: All / Favourites / labels: Edit, Favourite, Spam, Block, Delete. Spam: Edit, Not spam, Block, Delete. Blocked: Unblock. Spam and Blocked have a short note and Not spam / Unblock all.
  • Selecting: select mode or the checkbox over any photo, Shift+click ranges, Ctrl/⌘+click, Space; "Select all" (indeterminate when partial), "Select all 25 matching", Delete; a floating bar with Labels (add / remove), Favourite, Spam / Not spam, Block / Unblock, Export and Delete (confirmed with the count).
  • Detail (third pane on wide screens, a sheet on tablets, full screen with Back on phones): dotted cover, 96 px photo, name, favourite toggle, status, chips, e-mail; Call (tel:), Email, Message, Schedule (an .ics invite) and More (Edit, Favourite, Spam, Block, Delete, Copy email, Copy phone, Export vCard, Share); previous / next (J / K); Overview (phone "+1 (753) 456-7890" and e-mail with copy, city, added on with a relative time, company, job title, note, labels), Activity (a timeline) and Notes (yours editable, a teammate's read-only).
  • Forms: Edit inline in the detail, New Contact in a dialog (a sheet on phones). Photo by click or drop with a circle crop and Remove; first and last name, e-mail (checked, duplicates flagged with "View existing contact"), phone with a country code and live formatting, city with suggestions, company, job title, status, label toggles (+ New label), favourite, note, added on (read-only). Errors under each field, Save disabled until valid, Ctrl/⌘+Enter saves, Esc cancels, and "Discard unsaved changes?" before anything is lost.
  • Import / export: CSV (drop zone, first 5 rows, column mapping, "12 new, 2 duplicates skipped") and export of the view or the selection as CSV or vCard. All in the browser.
  • Shortcuts (? lists them): / N ↑ ↓ Enter J K E F X Delete Esc, g a / g f / g s / g b, 1 / 2 / 3. They pause while you type.
  • State in the URL: ?folder=spam&label=lead&status=active&q=…&view=grid&id=<contact>; view, sort, density and columns are remembered in localStorage.

Props

Prop
contacts, labelsyour data (Contact[], Label[] from components/contacts/types.ts); the demo book otherwise
links{ call, email, message, schedule }, each (contact) => href: point Email, Message and Schedule into your Mail, Chat and Calendar apps. Defaults: tel:, mailto:, sms: and an .ics invite
onContactsChange(contacts, labels) => void after every change, to save them
defaultContactId, defaultViewwhat opens first when the URL doesn't say
syncUrlfalse keeps the URL alone (live previews, several instances)

Where things live

Path
components/contacts/contacts.tsxContacts: panes by its own width, URL state, sheets and dialogs
components/contacts/logic.tspure helpers: filters, search, sort, groups, counts, phone and date formats, CSV, vCard, .ics
components/contacts/store.tsthe zustand store and the pure edits of the book (ops)
components/contacts/commands.tswhat buttons do: toasts with Undo, confirmations, the unsaved-changes guard
components/contacts/data.tsthe demo book: labels, statuses, notes, activity, the sample CSV
lib/people.tsthe people (name, e-mail, E.164 phone, city, company, photo), shared by the dashboard's apps
components/ui/the shadcn/ui primitives (Base UI flavour)
public/images/avatars/the 35 profile photos (npm run avatars, credits in CREDITS.md)

Photos: free Unsplash photos chosen to fit each name; people who also appear in the Mail and Chat apps (John Doe, Emma Wilson, Rachel Green, Alex Thompson, Sarah Johnson) have the same photo there. Names, companies, numbers (555-01xx and the other ranges kept for fiction) and notes are invented.

Checks

Command
npm run lint, npm run typecheck, npm run buildESLint, TypeScript, the production build
npm test15 unit tests of logic.ts and the demo data (Vitest)
node scripts/e2e.mjs82 clicks through every feature in Chrome (against RAPPORT_URL, default :5500)
node scripts/a11y.mjsaxe on 11 screens, light and dark
npm run shotsscreenshots: 12 views × light / dark × 1440, 1280, 1024, 768, 390 px into screenshots/
npm run registry, npm run zipthe listing copy in registry/ and rapport.zip for UpFork

Reviews and bugs

0 reviews · 0 bugs

Ship it0With fixes0Skip0· 0 reviews

0 bugs0 open0 fixed

Members who have it review it and report its bugs. Sign in

No reviews or bugs yet.

Manual installation

Without the CLI

  1. 01

    Install the packages

    npm install @base-ui/react @hookform/resolvers class-variance-authority libphonenumber-js lucide-react motion react-easy-crop react-hook-form sonner zod zustand
  2. 02

    Copy the files into your project

    • components/contacts/avatar-uploader.tsx
    • components/contacts/bits.tsx
    • components/contacts/bulk-bar.tsx
    • components/contacts/commands.ts
    • components/contacts/contact-detail.tsx
    • components/contacts/contact-form.tsx
    • components/contacts/contact-grid.tsx
    • components/contacts/contact-list.tsx
    • components/contacts/contact-menu.tsx
    • components/contacts/contact-notes.tsx
    • components/contacts/contact-table.tsx
    • components/contacts/contacts.tsx
    • components/contacts/data.ts
    • components/contacts/dialogs.tsx
    • components/contacts/empty-state.tsx
    • components/contacts/hooks.ts
    • components/contacts/import-dialog.tsx
    • components/contacts/logic.ts
    • components/contacts/selection.ts
    • components/contacts/sidebar.tsx
    • components/contacts/store.ts
    • components/contacts/toolbar.tsx
    • components/contacts/types.ts
    • components/contacts/ui/alert-dialog.tsx
    • components/contacts/ui/button.tsx
    • components/contacts/ui/checkbox.tsx
    • components/contacts/ui/collapsible.tsx
    • components/contacts/ui/context-menu.tsx
    • components/contacts/ui/dialog.tsx
    • components/contacts/ui/dropdown-menu.tsx
    • components/contacts/ui/input-group.tsx
    • components/contacts/ui/input.tsx
    • components/contacts/ui/kbd.tsx
    • components/contacts/ui/label.tsx
    • components/contacts/ui/popover.tsx
    • components/contacts/ui/select.tsx
    • components/contacts/ui/separator.tsx
    • components/contacts/ui/sheet.tsx
    • components/contacts/ui/skeleton.tsx
    • components/contacts/ui/slider.tsx
    • components/contacts/ui/switch.tsx
    • components/contacts/ui/tabs.tsx
    • components/contacts/ui/textarea.tsx
    • components/contacts/ui/toggle-group.tsx
    • components/contacts/ui/toggle.tsx
    • components/contacts/ui/tooltip.tsx
    • components/contacts/use-shortcuts.ts
    • lib/people.ts

    The paths follow the shadcn/ui layout, with @/ as your project’s import alias.

  3. 03

    Its pictures load from UpFork

    The code above points at UpFork’s copies (236 KB), so there’s nothing to copy. To host them yourself, use Download source: its ZIP has the files where the code expects them, and a README on the switch.

Before you buy

Everything you need to know

How this component gets from the preview into your project, and what buyers ask most.

How to use it

From the preview to your project

  1. 01

    Try it in the preview

    Switch between light and dark, and resize it to phone and tablet widths, before you decide.

  2. 02

    Get it

    Free products are yours with a free account. Paid ones settle in USDT on TRON, sent straight to the wallet on your order.

  3. 03

    Install it

    Components go into your project with one shadcn command, dependencies included. Everything else downloads with a checksum.

  4. 04

    Make it yours

    It's your code now: rename it, restyle it and wire in your real data.

  5. 05

    Or hand it to your AI

    Copy the prompt and let your coding assistant place it in your project, following your conventions.

Building with an AI assistant?

Copy a ready-made prompt with the code, its dependencies and a demo, and your assistant can put it in place for you.

Copy AI prompt

Selling your own work?

Get approved once, then publish components, templates and mobile components, paid in USDT straight to your own wallet.