Skip to content

forcedotcom/sf-skills / plugins/builder/experience-react/skills/experience-ui-bundle-frontend-generate

experience-ui-bundle-frontend-generate

Verified

MUST activate before editing ANY file under uiBundles/*/src/ (or the bundle's index.html) for visual or UI changes to an EXISTING app — pages, components, sections, layout, styling, colors, fonts, navigation, animations, branding, or any look-and-feel change. Use this skill when modifying pages, components, layout, styling, navigation, or branding in an existing UI bundle app. Activate when the project contains appLayout.tsx, routes.tsx, src/pages/, src/components/, src/styles/global.css, or the bundle's index.html. This skill contains critical project-specific conventions (appLayout.tsx shell, shadcn/ui components, Tailwind CSS, Salesforce base-path routing, module restrictions) that override general knowledge. Without this skill, generated code will use wrong imports, break routing, or ignore project structure. Do NOT use when creating a new app from scratch or the bundle has not been scaffolded yet (use experience-ui-bundle-app-coordinate instead).

FileKindSize
SKILL.mdskill md14.5 KB
references/component.mdmarkdown6.2 KB
references/header-footer.mdmarkdown5.7 KB
references/page.mdmarkdown5.5 KB
scripts/check-preconditions.mjsexecutablescript2.3 KB
scripts/resolve-ui-bundle.mjsexecutablescript2.5 KB
scripts/verify-rules.mjsexecutablescript3.3 KB

references/header-footer.md

View on GitHub
# Implementation — Header / Footer

### Rules

1. **Edit `appLayout.tsx` for the header/footer/nav shell itself** — layout-level concerns. Never add them to individual page files.
2. **Never modify `routes.tsx` or `app.tsx`** — the router setup must remain intact.
3. **Create component files in `src/components/layout/`** — the designated location for layout-level components.
4. **Use the full-height flex column pattern** — wrap layout in `min-h-screen flex flex-col` so footer stays at bottom.
5. **Use shadcn and Tailwind** — compose from `@/components/ui`; style with Tailwind utility classes and design tokens.
6. **Use path aliases** — import with `@/components/layout/...` and `@/components/ui`; no deep relative paths.
7. **Preserve existing content** — if `appLayout.tsx` already has a `<NavigationMenu />` or other shell elements, keep them in place.
8. **Renaming/rebranding the app is a two-file change, not one** — whenever the request changes the app's name/brand text (not just adding/styling a header or footer), you MUST also update `index.html`'s `<title>` at the bundle root. `appLayout.tsx` covers what's visible in the page body (header/nav brand, footer); `index.html`'s `<title>` covers the browser tab — neither substitutes for the other, and both are required. Do not stop after editing only `appLayout.tsx` for this kind of request.

### Step 1 — Create the header component (if requested)

Create `src/components/layout/AppHeader.tsx`:

```tsx
import { cn } from "@/lib/utils";

interface AppHeaderProps {
  className?: string;
}

export function AppHeader({ className }: AppHeaderProps) {
  return (
    <header
      className={cn(
        "w-full border-b bg-background px-4 sm:px-6 lg:px-8 py-4",
        className,
      )}
    >
      <div className="max-w-7xl mx-auto flex items-center justify-between">
        <span className="text-lg font-semibold text-foreground">My App</span>
      </div>
    </header>
  );
}
```

### Step 2 — Create the footer component (if requested)

Create `src/components/layout/AppFooter.tsx`:

```tsx
import { cn } from "@/lib/utils";

interface AppFooterProps {
  className?: string;
}

export function AppFooter({ className }: AppFooterProps) {
  return (
    <footer
      className={cn(
        "w-full border-t bg-background px-4 sm:px-6 lg:px-8 py-4",
        className,
      )}
    >
      <div className="max-w-7xl mx-auto text-center text-sm text-muted-foreground">
        &copy; {new Date().getFullYear()} My App. All rights reserved.
      </div>
    </footer>
  );
}
```

### Step 3 — Edit `appLayout.tsx`

Open `src/appLayout.tsx` — this is the **only file to modify** for layout-level additions. Wrap existing content in a flex column and add header above and footer below `<Outlet />`:

```tsx
import { Outlet } from "react-router";
import { AppHeader } from "@/components/layout/AppHeader";
import { AppFooter } from "@/components/layout/AppFooter";
// Keep all existing imports unchanged

export default function AppLayout() {
  return (
    <div className="min-h-screen flex flex-col bg-background">
      <AppHeader />
      {/* Keep any existing NavigationMenu or other shell elements here */}
      <main className="flex-1">
        <Outlet />
      </main>
      <AppFooter />
    </div>
  );
}
```

### File Locations — Header / Footer

| Component    | File                                  | Export                         |
| ------------ | ------------------------------------- | ------------------------------ |
| Header       | `src/components/layout/AppHeader.tsx` | Named export                   |
| Footer       | `src/components/layout/AppFooter.tsx` | Named export                   |
| Layout shell | `src/appLayout.tsx`                   | Default export (edit in place) |

### Why `appLayout.tsx` — Not Pages or Routes

`AppLayout` is the single shell rendered at the root route. Every page is a child rendered via `<Outlet />`. Placing the header and footer here ensures they appear on every page without touching individual pages or the route registry.

```text
AppLayout (appLayout.tsx)
├── AppHeader          ← renders on every page
├── NavigationMenu     ← keep if already present
├── <Outlet />         ← active page renders here
└── AppFooter          ← renders on every page
```

### Useful Patterns — Header / Footer

- **Sticky header:** add `sticky top-0 z-50` to the `<header>` element
- **Separator:** use `<Separator />` from `@/components/ui` instead of `border-b`/`border-t` if a visible divider is preferred
- **Nav links in header:** use `<Button variant="ghost" asChild>` wrapping a React Router `<Link>`
- **Icons:** `lucide-react`; add `aria-hidden="true"` on decorative icons
- **Design tokens:** `bg-background`, `text-foreground`, `text-muted-foreground`, `border`, `bg-primary`

### Mobile hamburger / Menu icon — Must be functional

If the header includes a hamburger or `Menu` icon for mobile:

- **Do not** add a Menu/hamburger icon that does nothing. It must toggle a visible mobile menu.
- **Required:** (1) State: `const [isOpen, setIsOpen] = useState(false)`. (2) Button: `onClick={() => setIsOpen(!isOpen)}`, `aria-label="Toggle menu"`. (3) Conditional panel: `{isOpen && ( <div>...nav links...</div> )}` with responsive visibility (e.g. `md:hidden`). (4) Close on navigate: each link in the panel should `onClick={() => setIsOpen(false)}`.
- Implement in `appLayout.tsx` (or the component that owns the header). Use the `Menu` icon from `lucide-react`.

### Confirm — Header / Footer

- Header and footer appear on every page (navigate to at least two routes)
- Imports use path aliases (`@/components/layout/...`)
- No inline `style={{}}` — Tailwind only
- `src/routes.tsx` and `src/app.tsx` are unchanged
brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).Stars: 322kUpdated Claude CodeCodexVerifiedInstall
brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).Stars: 198kUpdated Claude CodeCodexVerifiedInstall