# Click-to-edit & visual UI

> Point directly at buttons, headlines, and cards inside Preview to polish wording and spacing surgically without risking collateral layout regressions.

- Canonical: https://exaspark.ai/docs/click-to-edit-and-visual/

## Why surgical visual edits beat broad rewrites

Describing small visual tweaks in plain text is surprisingly error-prone. Writing `"Make the right card button darker with tighter copy and nudge the subtitle up"` forces the Agent to infer which component you mean and whether sibling cards should shift too.

That ambiguity causes two avoidable problems: **collateral regressions** (an unrelated section or mobile breakpoint moves unexpectedly) and wasted credits spent on broad passes for tiny cosmetic changes.

**Click-to-edit** removes that friction. By selecting the exact headline, button, image, or frame inside **Preview** or **Design Canvas**, you pin edits cleanly to one element — finishing visual polish in seconds while keeping layouts and backend logic untouched.

## Click-to-edit vs scoped chat vs Design Canvas

Fast ExaSpark builders pick the lightest visual control that matches the blast radius of their change.

| What you want to change | Best tool | Scope & safety | Credit impact | Example |
| --- | --- | --- | --- | --- |
| **Fix a typo, headline, or button label** | **Click-to-edit** | Single element; zero risk to other pages | Lightest & fastest | Changing `"Submit"` to `"Reserve my court"` in **Preview** |
| **Tweak single-element color or padding** | **Click-to-edit** | Surgical styling on the selected node | Light visual pass | Boosting hero CTA contrast or tightening subtitle margin |
| **Swap one static hero photo** | **Click-to-edit** | Replaces one image cleanly in place | Immediate | Swapping a placeholder hero for a studio product photo |
| **Update global palette or type scale** | **Scoped chat** (or **Design Canvas**) | Updates shared tokens across all routes | High leverage | Changing primary accent across every button and tab |
| **Edit behavior, states, or Cloud bindings** | **Scoped chat** | Coordinated UI, validation, and API pass | Full-stack precision | Showing a `"Sold Out"` badge when inventory hits `0` |
| **Compare brand-new page layouts** | **Design Canvas** | Explores 2–3 concepts off live code | Prevents rebuilds | Comparing editorial, grid, and dark homepages side by side |

## How to make surgical visual edits cleanly

Follow this five-step rhythm to polish copy and layout quickly without leaving stray styling clutter behind.

1. **Navigate Preview to the exact route and state** — Open the live view you want to refine, such as a signed-in dashboard, checkout drawer, or pricing grid.
2. **Select the exact target element** — Activate **click-to-edit** and click the text, button, badge, or container. Confirm the outline wraps the element you intend rather than a parent wrapper.
3. **Apply concise, focused edits** — Rewrite copy inline, tune alignment, adjust padding, or swap an image one clear attribute at a time.
4. **Inspect siblings and phone widths** — Check neighboring cards, then open [Browser Device Lab](https://exaspark.ai/docs/device-lab/) to ensure longer labels or tighter spacing still read cleanly on a 390px phone.
5. **Confirm interactive behavior still works** — Click edited buttons and links in **Preview** to verify navigation, modals, and **Cloud** submissions stay intact.

> **Note:** Batch related copy edits on the same screen into one focused polish pass instead of alternating single-word tweaks with full backend turns. Your checkpoint history stays cleaner and easier to revert.

## Subtle boundaries: static elements vs data-bound templates

Knowing where visible text originates prevents the most common visual-editing surprise. Not every label on screen is static markup.

### Static marketing copy and labels

Headlines, navigation items, section intros, CTA labels, FAQs, and footer links typically live directly in component code. Updating them with **click-to-edit** persists cleanly and deploys straight to **Live** when you click **Publish**.

### Repeating list items and database-driven cards

On storefronts, schedules, or member directories, titles (`"Ethiopian Yirgacheffe — $22"`) and timestamps (`"Thu 6:30 PM"`) load dynamically from your **Cloud** database.

- **Visual styling belongs to the shared card template.** Adjusting card padding, border radius, or title weight applies cleanly across every rendered card in that list.
- **Record values belong in Cloud tables.** To rename a single product or change its price from `$22` to `$24`, edit that row in the **Cloud** tab (or your `/admin` view) so catalog text, Stripe totals, and receipts match.

### Conditional states and avoiding inline sprawl

Direct clicking excels at the state visible right now. Hover styles, disabled submit labels, loading skeletons, empty states, and red validation messages are much faster to polish in one concise chat prompt.

Likewise, if you catch yourself manually adjusting margins on ten headings across three pages, pause and send one scoped chat turn codifying shared design tokens (`"Standardize all section H2s to 28px semibold"`). Every current and future screen will inherit the rule automatically.

## Pairing click-to-edit with high-precision prompts

Combine **click-to-edit** for local wording tweaks with crisp chat prompts for system-wide visual consistency.

Lock rough visual adjustments into uniform spacing and button tokens without disturbing app behavior:

> **Example prompt (Web):** Standardize visual polish across the homepage and pricing page: set section vertical padding to 64px on desktop and 40px on mobile, align all primary CTA buttons to one shared forest-green style with 44px minimum height, and keep card hairline borders uniform. Leave existing copy, routing, and Stripe checkout unchanged.

Refine dynamic states inside a data-backed screen that direct clicking cannot trigger easily:

> **Example prompt (App):** Polish visual hierarchy on /admin/bookings without changing Cloud queries: right-align currency columns with tabular numbers, soften status badges to light neutral tints with dark readable text, tighten row height for scanning, and add a crisp empty state with a Create Class button when filters match zero rows.

Run this quick five-point check before closing a visual polish pass:

```text
Visual polish check:
[ ] Primary CTA stands out immediately above the fold
[ ] Edited headlines wrap cleanly (2-3 lines max) on 390px phone screens
[ ] Dynamic titles and prices match Cloud tables and Stripe totals
[ ] Hover, focus, and disabled button states remain clearly readable
[ ] No orphan spacing gaps or clipped containers after copy edits
```

## Preventing and fixing collateral visual regressions

Use this reference table whenever a visual edit produces an unexpected result in **Preview**.

| Symptom | Likely cause | Fastest fix |
| --- | --- | --- |
| **Edited product title or price resets on reload** | Value loads from a **Cloud** database row rather than static UI text | Edit the record inside the **Cloud** tab or your `/admin` editor |
| **Styling one card changes every card in the row** | Cards render from one shared list template component | Ask in chat for a conditional rule (`"Highlight only the Popular tier"`) |
| **Desktop headline wraps onto 5 lines on phones** | Font size or side padding is too large for 390px viewports | Check [Browser Device Lab](https://exaspark.ai/docs/device-lab/) and add responsive type scaling |
| **Darkening a button makes text hard to read** | Background shifted without updating foreground ink contrast | Set label ink to high-contrast white or dark ink (`>= 4.5:1`) |
| **Manual tweaks made neighboring sections uneven** | Ad-hoc overrides drifted off your spacing cadence | Click **Undo** to a clean checkpoint, or re-align to locked design tokens in chat |
| **Swapped photo looks stretched or cropped badly** | Image aspect ratio differs from its frame container | Apply clean aspect-ratio framing (`object-cover`) or generate matched ratios in **Image** mode |

## Next steps

- [Working with the Agent](https://exaspark.ai/docs/working-with-the-agent/) — Combine click-to-edit, choice cards, Undo, and Ask AI to fix cleanly.
- [Design Canvas](https://exaspark.ai/docs/design-canvas/) — Compare layouts side by side before adopting them into live code.
- [Checkpoints, Undo & recovery](https://exaspark.ai/docs/checkpoints-and-undo/) — Revert visual missteps cleanly and branch risky redesigns safely.
- [Optimizing credits](https://exaspark.ai/docs/optimizing-credits/) — Save credits by picking the lightest editing tool for each task.

## From the blog

- [Design before you build](https://exaspark.ai/blog/design-before-you-build/) — Why locking visual hierarchy early prevents costly late-stage redesigns.
- [What to put on a homepage](https://exaspark.ai/blog/what-to-put-on-a-homepage/) — High-converting copy and visual order for first-time visitors.
- [How to build a landing page](https://exaspark.ai/blog/how-to-build-a-landing-page/) — Turn rough drafts into crisp, high-trust landing pages quickly.
