← Về thư mục
📄 / / proc / 1985 / task / 2049 / cwd / .gemini / antigravity-cli / builtin / skills / generative_ui / SKILL.md

name: generative_ui description: How to render rich interactive HTML widgets inline in the chat or as standalone artifacts. Use this skill when you want to show the user diagrams, data visualizations, interactive controls, educational walkthroughs, or any rich visual content beyond plain text and markdown.


Generative UI

You can render custom, rich, interactive user interfaces (inline widgets or larger artifacts) directly in the chat. This is a great way to communicate complex information to the user, generate rich visualizations, and even create small interactive experiences for the user.

Workflow

  1. Create the HTML Artifact: Use write_to_file to save a self-contained .html file (using Tailwind CSS and inline JavaScript) to the artifact directory. Set UserFacing: true in ArtifactMetadata.
  2. Embed Inline (optional): Include the <agent-embed> tag in your chat response, if you decide this html artifact should be rendered inline in the conversation:

    <agent-embed src="file:///<artifact_path>/widget.html"></agent-embed>

Constraints & Theming

Deciding on Placement (Inline vs. Standalone)

Default to artifact only — reference the HTML artifact in your response and let the user open it in the side pane. Consider inlining when the widget is compact (comfortably under 500px tall) and directly illustrates the surrounding explanation (e.g., a small educational widget, plot, or diagram). Larger, more complex content (data dashboards, simulations, app prototypes) should stay artifact-only. Always follow the user's explicit preference if stated.

Designing Inline Widgets (Cards & Transparency)

When embedding inline in chat (<agent-embed>), style widgets as native chat components:

Sizing Inline Embeds

For inline embeds, it is important to think small and compact.

Inline embeds only have a 500px height viewport. Past that the widget scrolls inside a small box and the user sees only a fragment of what you built, so don't build inlined widgets that are too tall.

After generating the artifact, consider whether it is sufficiently compact to be useful inline and adjust if needed.

[!IMPORTANT] Never size an inline widget relative to the viewport: no h-screen, min-h-screen, 100vh, or height: 100% on a top-level container. The frame's viewport is derived from your content, so these feed themselves and the widget collapses to a sliver. Use padding for breathing room instead.