id stringlengths 9 22 | name stringlengths 9 22 | description stringlengths 30 75 | author stringclasses 4
values | tags stringlengths 2 54 | category stringclasses 5
values | html_template stringlengths 77 4.11k | css_template stringlengths 0 17.1k | js_on_load stringlengths 163 69.6k | default_props stringlengths 2 11.5k | head stringclasses 2
values | python_code stringlengths 748 25.4k | repo_url stringclasses 3
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
camera-control3-d | Camera Control3 D | A 3D camera control component using Three.js. | multimodalart | ["3D", "Image"] | Input |
<div id="camera-control-wrapper" style="width: 100%; height: 450px; position: relative; background: #1a1a1a; border-radius: 12px; overflow: hidden;">
<div id="prompt-overlay" style="position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,0.8); padding: 8px 1... |
(() => {
const wrapper = element.querySelector('#camera-control-wrapper');
const promptOverlay = element.querySelector('#prompt-overlay');
// Wait for THREE to load
const initScene = () => {
if (typeof THREE === 'undefined') {
... | {"value": {"azimuth": 0, "elevation": 0, "distance": 1.0}, "imageUrl": null} | <script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script> | class CameraControl3D(gr.HTML):
"""
A 3D camera control component using Three.js.
Outputs: { azimuth: number, elevation: number, distance: number }
Accepts imageUrl prop to display user's uploaded image on the plane.
"""
def __init__(self, value=None, imageUrl=None, **kwargs):
if value i... | https://huggingface.co/spaces/multimodalart/qwen-image-multiple-angles-3d-camera/ | |
detection-viewer | Detection Viewer | Rich viewer for object detection model outputs | hysts | [] | display | <div class="pose-viewer-container" data-panel-title="Detections" data-list-height="300" data-score-threshold-min="0.0" data-score-threshold-max="1.0" data-keypoint-threshold="0.0" data-keypoint-radius="3">
<script type="application/json" class="pose-data">${value}</script>
<div class="canvas-wrapper">
<canvas><... | .pose-viewer-container {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
user-select: none;
width: 100%;
position: relative;
box-sizing: border-box;
}
/* ── Maximized Overlay ── */
.pose-viewer-container.maximized {
position: fixed;
top: 0;
left: 0;
... | // Guard: skip if already initialized
if (element._poseInitialized) return;
element._poseInitialized = true;
(function () {
"use strict";
var MAX_CANVAS_HEIGHT = 600;
var KEYPOINT_RADIUS = 3;
var HIT_RADIUS = 10;
var MASK_ALPHA = 0.4;
var CONNECTION_ALPHA = 0.7;
var CONNECTION_WIDTH = 2;
... | {"value": "{\"image\": \"https://huggingface.co/datasets/gradio/custom-html-gallery/resolve/main/assets/hyst_image.webp\", \"annotations\": [{\"keypoints\": [], \"connections\": [], \"color\": \"#FF0000\", \"label\": \"microwave\", \"bbox\": {\"x\": 1254.9686279296875, \"y\": 732.0140991210938, \"width\": 731.187622070... | null | class DetectionViewer(gr.HTML):
def __init__(
self,
value: tuple[str | Path | Image.Image | np.ndarray, list[dict[str, Any]]]
| tuple[str | Path | Image.Image | np.ndarray, list[dict[str, Any]], dict[str, Any]]
| None = None,
*,
label: str | None = None,
panel... | https://github.com/hysts/gradio-detection-viewer/ |
contribution-heatmap | Contribution Heatmap | Reusable GitHub-style contribution heatmap | ysharma | ["Business"] | Display |
<div class="heatmap-container">
<div class="heatmap-header">
<h2>${(() => {
const total = Object.values(value || {}).reduce((a, b) => a + b, 0);
return '📊 ' + total.toLocaleString() + ' contributions in ' + year;
})()}</h2>
<div class="legend">
<span>Les... |
.heatmap-container {
background: #0d1117;
border-radius: 12px;
padding: 24px;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
color: #c9d1d9;
overflow-x: auto;
}
.heatmap-header {
display: flex; justify-content: space-between; ... |
element.addEventListener('click', (e) => {
if (e.target && e.target.classList.contains('cell') && !e.target.classList.contains('empty')) {
const date = e.target.dataset.date;
const cur = parseInt(e.target.dataset.count) || 0;
const next = cur >= 12 ? 0 : cur + 1;
... | {"value": {"2025-01-01": 15, "2025-01-02": 10, "2025-01-05": 2, "2025-01-06": 2, "2025-01-07": 3, "2025-01-08": 7, "2025-01-13": 1, "2025-01-14": 3, "2025-01-15": 1, "2025-01-17": 1, "2025-01-19": 5, "2025-01-20": 4, "2025-01-22": 1, "2025-01-26": 2, "2025-01-27": 11, "2025-01-28": 1, "2025-01-29": 2, "2025-02-02": 2, ... | class ContributionHeatmap(gr.HTML):
"""Reusable GitHub-style contribution heatmap built on gr.HTML."""
def __init__(self, value=None, year=2025, theme="green",
c0=None, c1=None, c2=None, c3=None, c4=None, **kwargs):
if value is None:
value = {}
# Use explicit c0-c4 ... | https://huggingface.co/spaces/ysharma/github-contribution-heatmap | |
spin-wheel | Spin Wheel | Spin the wheel to win a prize! | ysharma | [] | display |
<div class="wheel-container">
<div class="wheel-wrapper">
<!-- Pointer -->
<div class="wheel-pointer">▼</div>
<!-- Wheel - rotation prop preserves position across re-renders -->
<div class="wheel" id="prize-wheel" style="transform: rotate(${rotation || 0}deg);">
... |
.wheel-container {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
display: flex;
flex-direction: column;
align-items: center;
padding: 24px;
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
border-radius: 24px;
... |
const container = element.querySelector('.wheel-container');
const wheel = element.querySelector('#prize-wheel');
const spinBtn = element.querySelector('#spin-btn');
const confettiContainer = element.querySelector('#confetti');
const resultDisplay = element.querySelector('#result-display');
... | {"value": "", "segments_json": "[{\"label\": \"\\ud83c\\udf81 Grand Prize\", \"color\": \"#FF6B6B\", \"startAngle\": 0, \"endAngle\": 45.0, \"midAngle\": 22.5}, {\"label\": \"\\ud83d\\udc8e 50 Gems\", \"color\": \"#4ECDC4\", \"startAngle\": 45.0, \"endAngle\": 90.0, \"midAngle\": 67.5}, {\"label\": \"\\u2b50 100 XP\", ... | null | class SpinWheel(gr.HTML):
"""
An interactive prize wheel component with:
- Smooth CSS spinning animation
- Customizable segments with colors
- Win detection with callbacks
- Confetti celebration effect
"""
def __init__(
self,
value=None, # Currently selected/won prize (s... | null |
star-rating | Star Rating | Click stars to set a rating from 1 to 5 | gradio | ["input", "rating", "stars"] | input | <h2>${label} rating:</h2>
${Array.from({length: 5}, (_, i) => `<img class='${i < value ? '' : 'faded'}' src='https://upload.wikimedia.org/wikipedia/commons/d/df/Award-star-gold-3d.svg'>`).join('')} | img { height: 50px; display: inline-block; cursor: pointer; }
.faded { filter: grayscale(100%); opacity: 0.3; } | const imgs = element.querySelectorAll('img');
imgs.forEach((img, index) => {
img.addEventListener('click', () => {
props.value = index + 1;
});
}); | {"value": 3, "label": "Food"} | null | class StarRating(gr.HTML):
def __init__(self, label, value=0, **kwargs):
html_template = """
<h2>${label} rating:</h2>
${Array.from({length: 5}, (_, i) => `<img class='${i < value ? '' : 'faded'}' src='https://upload.wikimedia.org/wikipedia/commons/d/df/Award-star-gold-3d.svg'>`).join('')}
... | null |
button-set | Button Set | Multiple buttons that trigger events with click data | gradio | ["input", "buttons", "events"] | input | <button id='A'>A</button>
<button id='B'>B</button>
<button id='C'>C</button> | button {
padding: 10px 20px;
background-color: #f97316;
color: white;
border: none;
border-radius: 8px;
cursor: pointer;
font-weight: 600;
margin-right: 8px;
transition: background 0.15s;
}
button:hover { background-color: #ea580c; } | const buttons = element.querySelectorAll('button');
buttons.forEach(button => {
button.addEventListener('click', () => {
trigger('click', {clicked: button.innerText});
});
}); | {} | null | button_set = gr.HTML(
html_template="""
<button id='A'>A</button>
<button id='B'>B</button>
<button id='C'>C</button>
""",
css_template="""
button {
padding: 10px 20px;
background-color: #f97316;
color: white; border: none;
border-radius: 8px; cursor: pointer;... | null |
progress-bar | Progress Bar | Interactive progress bar - click the track to set progress | gradio | ["display", "progress", "animation"] | display | <div class="progress-container">
<div class="progress-label">${label}</div>
<div class="progress-track">
<div class="progress-fill" style="width: ${value}%"></div>
</div>
<div class="progress-text">${value}%</div>
</div> | .progress-container { padding: 8px 0; }
.progress-label { font-weight: 600; margin-bottom: 8px; font-size: 15px; }
.progress-track { width: 100%; height: 24px; background: #e5e7eb; border-radius: 12px; overflow: hidden; cursor: pointer; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #f97316, #fb923... | const track = element.querySelector('.progress-track');
track.addEventListener('click', (e) => {
const rect = track.getBoundingClientRect();
const pct = Math.round(((e.clientX - rect.left) / rect.width) * 100);
props.value = Math.max(0, Math.min(100, pct));
}); | {"value": 65, "label": "Upload Progress"} | null | progress = gr.HTML(
value=65,
label="Upload Progress",
html_template="""
<div class="progress-container">
<div class="progress-label">${label}</div>
<div class="progress-track">
<div class="progress-fill" style="width: ${value}%"></div>
</div>
<div class="prog... | null |
likert-scale | Likert Scale | Agreement scale from Strongly Disagree to Strongly Agree | gradio | ["input", "survey", "scale"] | input | <div class="likert-container">
<div class="likert-question">${question}</div>
<div class="likert-scale">
${['Strongly Disagree', 'Disagree', 'Neutral', 'Agree', 'Strongly Agree'].map((label, i) => `
<label class="likert-option ${value === i + 1 ? 'selected' : ''}">
<input typ... | .likert-container { padding: 8px 0; }
.likert-question { font-weight: 600; margin-bottom: 16px; font-size: 15px; }
.likert-scale { display: flex; justify-content: space-between; gap: 4px; }
.likert-option { display: flex; flex-direction: column; align-items: center; cursor: pointer; flex: 1; gap: 8px; }
.likert-option ... | const radios = element.querySelectorAll('input[type="radio"]');
radios.forEach(radio => {
radio.addEventListener('change', () => {
props.value = parseInt(radio.value);
});
}); | {"value": 0, "question": "This component is easy to use"} | null | class LikertScale(gr.HTML):
def __init__(self, question="Rate this item", value=0, **kwargs):
html_template = """
<div class="likert-container">
<div class="likert-question">${question}</div>
<div class="likert-scale">
${['Strongly Disagree', 'Disagree', 'Neut... | null |
tag-input | Tag Input | Add and remove tags with keyboard input | gradio | ["input", "tags", "text"] | input | <div class="tag-input-container">
<div class="tag-list">
${(value || []).map((tag, i) => `
<span class="tag-pill">
${tag}
<button class="tag-remove" data-index="${i}">×</button>
</span>
`).join('')}
<input type="text" class="tag-t... | .tag-input-container { padding: 4px 0; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px; border: 1px solid #e5e7eb; border-radius: 8px; min-height: 42px; }
.tag-pill { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; background: #fff7ed; color: #ea580c; bo... | const input = element.querySelector('.tag-text-input');
input.addEventListener('keydown', (e) => {
if (e.key === 'Enter' && input.value.trim()) {
e.preventDefault();
const tags = [...(props.value || []), input.value.trim()];
props.value = tags;
input.value = '';
}
if (e.key =... | {"value": ["python", "gradio", "html"]} | null | class TagInput(gr.HTML):
def __init__(self, value=None, **kwargs):
html_template = """
<div class="tag-input-container">
<div class="tag-list">
${(value || []).map((tag, i) => `
<span class="tag-pill">
${tag}
... | null |
colored-checkbox-group | Colored Checkbox Group | Multi-select checkbox group with custom colors per option | gradio | ["input", "checkbox", "color"] | input | <div class="colored-checkbox-container">
${label ? `<label class="container-label">${label}</label>` : ''}
<div class="colored-checkbox-group">
${choices.map((choice, i) => `
<label class="checkbox-label" data-color-index="${i}">
<input type="checkbox" value="${choice}" ${(va... | .colored-checkbox-container { border: 1px solid #e5e7eb; border-radius: 12px; padding: 16px; }
.container-label { display: block; margin-bottom: 12px; font-weight: 600; }
.colored-checkbox-group { display: flex; flex-direction: column; gap: 6px; }
.checkbox-label { display: flex; align-items: center; cursor: pointer; p... | const checkboxes = element.querySelectorAll('input[type="checkbox"]');
checkboxes.forEach(checkbox => {
checkbox.addEventListener('change', () => {
props.value = Array.from(checkboxes)
.filter(cb => cb.checked)
.map(cb => cb.value);
});
}); | {"value": [], "choices": ["Apple", "Banana", "Cherry"], "colors": ["#dc2626", "#eab308", "#dc2626"], "label": "Select fruits"} | null | class ColoredCheckboxGroup(gr.HTML):
def __init__(self, choices, *, value=None, colors, label=None, **kwargs):
html_template = """
<div class="colored-checkbox-container">
${label ? `<label>${label}</label>` : ''}
<div class="colored-checkbox-group">
${choices... | null |
todo-list | Todo List | Interactive checklist with strikethrough on completed items | gradio | ["form", "todo", "checklist"] | form | <h2>Todo List</h2>
<ul>
${value.map((item, index) => `
<li style="text-decoration: ${completed.includes(index) ? 'line-through' : 'none'}; list-style: none; padding: 6px 0;">
<input type="checkbox" ${completed.includes(index) ? 'checked' : ''} data-index="${index}" />
${item}
... | h2 { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
ul { padding: 0; margin: 0; }
li { font-size: 14px; transition: opacity 0.2s; }
li input { margin-right: 8px; cursor: pointer; } | const checkboxes = element.querySelectorAll('input[type="checkbox"]');
checkboxes.forEach(checkbox => {
checkbox.addEventListener('change', () => {
const index = parseInt(checkbox.getAttribute('data-index'));
let completed = props.completed || [];
if (checkbox.checked) {
if (!com... | {"value": ["Buy groceries", "Walk the dog", "Read a book", "Write code"], "completed": [1]} | null | class TodoList(gr.HTML):
def __init__(self, value=None, completed=None, **kwargs):
html_template = """
<h2>Todo List</h2>
<ul>
${value.map((item, index) => `
<li style="text-decoration: ${completed.includes(index) ? 'line-through' : 'none'};">
... | null |
audio-gallery | Audio Gallery | Grid of audio players with waveform visualization and selection | gradio | ["display", "audio", "gallery", "media"] | display | <div class="audio-gallery-container">
${label ? `<label class="container-label">${label}</label>` : ''}
<div class="audio-gallery-grid" style="grid-template-columns: repeat(${columns}, 1fr);">
${audio_urls.map((url, i) => `
<div class="audio-item" data-index="${i}">
<div clas... | .audio-gallery-container { padding: 8px; }
.container-label { display: block; margin-bottom: 12px; font-weight: 600; }
.audio-gallery-grid { display: grid; gap: 12px; }
.audio-item { border: 2px solid #e5e7eb; border-radius: 10px; padding: 12px; cursor: pointer; transition: all 0.2s; }
.audio-item:hover { border-color:... | const audioItems = element.querySelectorAll('.audio-item');
audioItems.forEach((item, index) => {
const canvas = item.querySelector('.waveform-canvas');
const audio = item.querySelector('audio');
const playBtn = item.querySelector('.play-btn');
const timeDisplay = item.querySelector('.time-display');
... | {"value": null, "audio_urls": ["https://github.com/gradio-app/gradio/raw/main/test/test_files/audio_sample.wav", "https://github.com/gradio-app/gradio/raw/main/test/test_files/audio_sample-1-4.wav", "https://github.com/gradio-app/gradio/raw/main/gradio/media_assets/audio/cantina.wav"], "labels": ["Sample 1", "Sample 2"... | null | class AudioGallery(gr.HTML):
def __init__(self, audio_urls, *, value=None, labels=None,
columns=3, label=None, **kwargs):
html_template = """
<div class="audio-gallery-container">
${label ? `<label>${label}</label>` : ''}
<div class="audio-gallery-grid"
... | null |
kanban-board | Kanban Board | Drag-and-drop Kanban board with inline editing, priority labels, and search | gradio | ["input", "kanban", "drag-drop", "project-management"] | input | <div class="kanban-wrapper">
<div class="kanban-header">
<h2>${board_title}</h2>
<div class="header-right">
<div class="search-box">
<span class="search-icon">🔍</span>
<input type="text" class="search-input" placeholder="Search cards..." />
</... | .kanban-wrapper {
background: linear-gradient(135deg, #0f172a 0%, #1a1a2e 100%);
border-radius: 16px;
padding: 24px;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
color: #e2e8f0;
overflow-x: auto;
}
.kanban-header { display: flex; justify-content: space-between; align-i... | let dragSrcColIdx = null;
let dragSrcCardIdx = null;
element.addEventListener('dragstart', (e) => {
const card = e.target.closest('.kanban-card');
if (!card) return;
dragSrcColIdx = parseInt(card.dataset.colIdx);
dragSrcCardIdx = parseInt(card.dataset.cardIdx);
card.classList.add('dragging');
e.... | {"board_title": "My Board", "value": {"columns": [{"id": "todo", "title": "\ud83d\udccb To Do", "color": "#6366f1", "cards": [{"id": "1", "text": "Research gr.HTML component", "priority": "high", "tags": ["gradio"]}, {"id": "2", "text": "Design the UI layout", "priority": "medium", "tags": ["design"]}, {"id": "3", "tex... | null | class KanbanBoard(gr.HTML):
"""A drag-and-drop Kanban board component."""
def __init__(self, value=None, board_title="My Board", **kwargs):
if value is None:
value = {
"columns": [
{
"id": "todo", "title": "To Do", "color": "#6366f... | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.