@shlomi.api/claude-test-component
v1.0.0
Published
Test HTML component for Claude artifacts
Downloads
2
Maintainers
Readme
Claude Test Component
A test HTML component that can be loaded in Claude artifacts via NPM and jsDelivr CDN.
Features
- ✅ Styled with modern CSS (gradient background, animations)
- ✅ Interactive with JavaScript (click counter, alerts)
- ✅ Animated entrance effect
- ✅ Click handler demo with visual feedback
- ✅ Console logging for debugging
Usage in Claude Artifacts
Method 1: Direct Fetch and Inject
async function loadComponent() {
const url = 'https://cdn.jsdelivr.net/npm/@shlomi.api/[email protected]/component.html';
try {
const response = await fetch(url);
const html = await response.text();
// Inject HTML
document.getElementById('component-target').innerHTML = html;
// Execute scripts
const scripts = document.getElementById('component-target').getElementsByTagName('script');
for (let script of scripts) {
const newScript = document.createElement('script');
newScript.textContent = script.textContent;
script.parentNode.replaceChild(newScript, script);
}
console.log('✅ Component loaded!');
} catch (error) {
console.error('❌ Failed to load:', error);
}
}
// Auto-load on page load
loadComponent();Method 2: Simple HTML
<!DOCTYPE html>
<html>
<body>
<div id="component-target"></div>
<script>
fetch('https://cdn.jsdelivr.net/npm/@shlomi.api/[email protected]/component.html')
.then(r => r.text())
.then(html => {
document.getElementById('component-target').innerHTML = html;
});
</script>
</body>
</html>CDN URLs
- Latest version:
https://cdn.jsdelivr.net/npm/@shlomi.api/claude-test-component@latest/component.html - Specific version:
https://cdn.jsdelivr.net/npm/@shlomi.api/[email protected]/component.html - NPM page:
https://www.npmjs.com/package/@shlomi.api/claude-test-component
What This Demonstrates
This component proves that:
- NPM packages can host HTML components
- jsDelivr CDN can serve them reliably
- Claude artifacts can fetch and render them
- CSS styling is preserved
- JavaScript functionality works
- Interactive elements function properly
Development
To update this component:
# Clone/edit the files
npm version patch # or minor, major
npm publish --access publicLicense
MIT
Author
Shlomi Schwartz
