A curated collection of clean, accessible HTML components. No frameworks, no dependencies — just pure, production-ready source code.
Optimized for performance. Zero runtime overhead.
<!-- Button Set Component --> <div class="btn-group"> <button class="btn btn-primary">Primary</button> <button class="btn btn-outline">Outline</button> <button class="btn btn-ghost">Ghost</button> </div> <style> .btn-group { display: flex; gap: 10px; } .btn { padding: 8px 20px; border-radius: 5px; font-size: 13px; font-weight: 500; cursor: pointer; transition: opacity 0.2s; } .btn-primary { background: #6c63ff; color: #fff; border: none; } .btn-outline { background: transparent; border: 2px solid #6c63ff; color: #6c63ff; } .btn-ghost { background: transparent; border: 2px solid #ccc; color: #555; } .btn:hover { opacity: 0.82; } </style>
<!-- Feature Card Component --> <div class="feat-card"> <div class="feat-icon"> <!-- icon svg here --> </div> <h3>Lightning Fast</h3> <p>Optimized for performance. Zero runtime overhead.</p> </div> <style> .feat-card { background: #fff; border-radius: 12px; padding: 20px; box-shadow: 0 4px 20px rgba(0,0,0,0.08); max-width: 280px; } .feat-icon { width: 36px; height: 36px; background: #ede9fe; border-radius: 8px; display: flex; align-items: center; justify-content: center; margin-bottom: 12px; } .feat-card h3 { font-size: 14px; font-weight: 600; color: #111; } .feat-card p { font-size: 12px; color: #666; margin-top: 4px; } </style>
<!-- Status Badge Components --> <span class="badge badge-green">Success</span> <span class="badge badge-red">Error</span> <span class="badge badge-blue">Info</span> <span class="badge badge-yellow">Warning</span> <style> .badge { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 11px; font-weight: 500; letter-spacing: 0.04em; } .badge-green { background: #dcfce7; color: #166534; } .badge-red { background: #fee2e2; color: #991b1b; } .badge-blue { background: #dbeafe; color: #1e40af; } .badge-yellow { background: #fef9c3; color: #854d0e; } </style>
<!-- Labeled Form Input --> <div class="field"> <label for="email">Email Address</label> <input id="email" type="email" placeholder="hello@example.com" /> </div> <style> .field { display: flex; flex-direction: column; gap: 6px; } .field label { font-size: 11px; font-weight: 600; color: #555; letter-spacing: 0.05em; text-transform: uppercase; } .field input { padding: 9px 14px; border: 1.5px solid #d0d0d0; border-radius: 7px; font-size: 13px; outline: none; transition: border-color 0.2s; } .field input:focus { border-color: #6c63ff; } </style>
<!-- Info Alert Component --> <div class="alert alert-info" role="alert"> <div class="alert-icon">i</div> <div> <p class="alert-title">Heads up!</p> <p class="alert-msg">Your plan renews in 3 days.</p> </div> </div> <style> .alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: 8px; } .alert-info { background: #eff6ff; border: 1px solid #bfdbfe; } .alert-icon { width: 18px; height: 18px; border-radius: 50%; background: #3b82f6; color: white; font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; } .alert-title { font-size: 13px; font-weight: 600; color: #1e3a5f; } .alert-msg { font-size: 11px; color: #3b82f6; } </style>
<!-- Avatar Stack Component --> <div class="avatar-stack"> <div class="avatar" style="background:#6c63ff">AK</div> <div class="avatar" style="background:#f0a05a">BR</div> <div class="avatar" style="background:#3bb577">CL</div> <div class="avatar avatar-more">+8</div> </div> <style> .avatar-stack { display: flex; align-items: center; } .avatar { width: 40px; height: 40px; border-radius: 50%; border: 3px solid #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: #fff; margin-left: -8px; } .avatar:first-child { margin-left: 0; } .avatar-more { background: #444; font-size: 11px; } </style>
<!-- Toggle Switch Component --> <label class="toggle"> <input type="checkbox" checked> <span class="track"></span> <span class="label">Notifications enabled</span> </label> <style> .toggle { display: flex; align-items: center; gap: 12px; cursor: pointer; } .toggle input { display: none; } .track { width: 44px; height: 24px; border-radius: 12px; background: #ccc; position: relative; transition: background 0.25s; } .track::after { content: ''; width: 18px; height: 18px; border-radius: 50%; background: #fff; position: absolute; top: 3px; left: 3px; transition: transform 0.25s; box-shadow: 0 1px 4px rgba(0,0,0,0.2); } input:checked + .track { background: #6c63ff; } input:checked + .track::after { transform: translateX(20px); } .label { font-size: 13px; color: #333; } </style>
Every component is pure HTML and CSS. No npm install, no build steps, no hidden imports. Copy a snippet and it works.
Semantic markup, ARIA labels, keyboard navigation, and proper contrast ratios are baked in from the start — not added as an afterthought.
No magic class names or locked styles. Each component ships as plain, readable CSS you can tweak, extend, or completely override.
SourceCraft is a living library of UI components — each one hand-crafted, well-commented, and designed to be understandable at a glance. No mystery abstractions. Just clean code you can own.
Browse the components above, click any card to reveal its source, then copy it directly into your project. MIT licensed — use it anywhere.