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.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Generative Ui?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/yaqob3653-generative-ui)
---
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 or in the side pane. 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_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 iframe embed in your chat response when this html artifact should be rendered inline in the conversation:
```html
<iframe src="file:///<artifact_path>/widget.html" class="w-full border-none rounded-xl" style="height: 480px;"></iframe>
```
## Constraints & Theming
* **Styling & Tailwind CSS**: Style your artifacts cleanly using Tailwind CSS. Include the following script tag in your `<head>` to enable Tailwind:
```html
<script src="https://cdn.tailwindcss.com"></script>
```
* **Use Provided Theme Variables**: The host environment injects semantic design-system tokens, so widgets automatically match the host theme and custom colors:
- Surfaces: `--background`, `--card`, `--sidebar`
- Borders: `--border`
- Text: `--foreground`, `--muted-foreground`, `--placeholder`
- Accents: `--primary`, `--primary-foreground`, `--accent`
- Typography is applied automatically — avoid sub-12px micro-text (`text-[10px]`, `text-[11px]`, or CSS `font-size` below 12px; keep `text-xs` / 12px as minimum floor).
* **HTML Boilerplate Template**: Recommended base template:
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.tailwindcss.com"></script>
<style>
:root {
--background: #121316;
--card: #1c1d22;
--border: #2e3038;
--foreground: #f1f2f6;
--muted-foreground: #9ca3af;
--accent: #8b5cf6;
}
</style>
</head>
<body class="bg-transparent text-[var(--foreground)] antialiased p-5">
<div class="bg-[var(--card)] text-[var(--foreground)] border border-[var(--border)] rounded-xl p-5 shadow-sm">
<h2 class="text-[var(--foreground)] font-semibold text-lg">Title</h2>
<p class="text-[var(--muted-foreground)] text-sm mb-4">Description of the component</p>
<!-- Interactive content and controls go here -->
</div>
</body>
</html>
```
## Sizing Inline Embeds
- Inline embeds look best within a 450px–500px height budget.
- Never size an inline widget with `h-screen`, `min-h-screen`, `100vh`, or `height: 100%` on a top-level container. Use padding for breathing room instead.