laguagu/claude-code-nextjs-skills / skills/ai-elements
ai-elements
VerifiedMaintains AI chat UI built from elements.ai-sdk.dev AI Elements components already copied into the project. Use when changing or debugging those components (conversations, messages, prompt inputs, attachments, reasoning, tool output, sources). New chat UI uses the shadcn/ui AI Elements patterns (`shadcn` skill).
scripts/web-preview.tsx
View on GitHub"use client";
import {
WebPreview,
WebPreviewBody,
WebPreviewConsole,
WebPreviewNavigation,
WebPreviewNavigationButton,
WebPreviewUrl,
} from "@/components/ai-elements/web-preview";
import {
ArrowLeftIcon,
ArrowRightIcon,
ExternalLinkIcon,
Maximize2Icon,
MousePointerClickIcon,
RefreshCcwIcon,
} from "lucide-react";
import { useCallback, useState } from "react";
const handleUrlChange = (url: string) => {
console.log("URL changed to:", url);
};
const handleGoBack = () => {
console.log("Go back");
};
const handleGoForward = () => {
console.log("Go forward");
};
const handleReload = () => {
console.log("Reload");
};
const handleSelect = () => {
console.log("Select");
};
const handleOpenInNewTab = () => {
console.log("Open in new tab");
};
const exampleLogs = [
{
level: "log" as const,
message: "Page loaded successfully",
timestamp: new Date(Date.now() - 10_000),
},
{
level: "warn" as const,
message: "Deprecated API usage detected",
timestamp: new Date(Date.now() - 5000),
},
{
level: "error" as const,
message: "Failed to load resource",
timestamp: new Date(),
},
];
const Example = () => {
const [_fullscreen, setFullscreen] = useState(false);
const handleToggleFullscreen = useCallback(
() => setFullscreen((prev) => !prev),
[]
);
return (
<WebPreview
defaultUrl="/"
onUrlChange={handleUrlChange}
style={{ height: "400px" }}
>
<WebPreviewNavigation>
<WebPreviewNavigationButton onClick={handleGoBack} tooltip="Go back">
<ArrowLeftIcon className="size-4" />
</WebPreviewNavigationButton>
<WebPreviewNavigationButton
onClick={handleGoForward}
tooltip="Go forward"
>
<ArrowRightIcon className="size-4" />
</WebPreviewNavigationButton>
<WebPreviewNavigationButton onClick={handleReload} tooltip="Reload">
<RefreshCcwIcon className="size-4" />
</WebPreviewNavigationButton>
<WebPreviewUrl />
<WebPreviewNavigationButton onClick={handleSelect} tooltip="Select">
<MousePointerClickIcon className="size-4" />
</WebPreviewNavigationButton>
<WebPreviewNavigationButton
onClick={handleOpenInNewTab}
tooltip="Open in new tab"
>
<ExternalLinkIcon className="size-4" />
</WebPreviewNavigationButton>
<WebPreviewNavigationButton
onClick={handleToggleFullscreen}
tooltip="Maximize"
>
<Maximize2Icon className="size-4" />
</WebPreviewNavigationButton>
</WebPreviewNavigation>
<WebPreviewBody src="https://preview-v0me-kzml7zc6fkcvbyhzrf47.vusercontent.net/" />
<WebPreviewConsole logs={exampleLogs} />
</WebPreview>
);
};
export default Example;
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| 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: 322k | Updated | Claude CodeCodex | Verified | Install |
| 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: 198k | Updated | Claude CodeCodex | Verified | Install |
| 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: 198k | Updated | Claude CodeCodex | Verified | Install |
| 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: 198k | Updated | Claude CodeCodex | Verified | Install |