CSS components templates
Buttons, loaders, tooltips, modals and accordions.
10 templates
Small interface pieces that get reached for constantly and reimplemented badly. Several of these use HTML elements that already do the job, which is almost always better than rebuilding it in JavaScript.
Button set
Primary, secondary, ghost and danger, in three sizes, with every state covered.
HTMLCSSTailwindLoaders and skeletons
Six loading indicators in pure CSS, plus the skeleton pattern that usually beats all of them.
HTMLCSSModal dialog
A modal built on the native dialog element — focus trap and backdrop included, for free.
HTMLCSSJavaScriptAccordion and FAQ
Built on details and summary — open, close and keyboard support with no JavaScript.
HTMLCSSTooltips
CSS-only tooltips on four sides, plus the anchor-positioning version.
HTMLCSSBadges, tags and pills
Status badges, removable tags, counters and dot indicators.
HTMLCSSAlerts and toasts
Four inline alert types plus a stacking toast system with correct live regions.
HTMLCSSJavaScriptTabs
The WAI-ARIA tab pattern, with arrow-key navigation and a sliding indicator.
HTMLCSSJavaScriptPagination
Numbered pages with an ellipsis, plus simple previous and next.
HTMLCSSToggle switch
A switch built on a real checkbox, with sizes, labels and a disabled state.
HTMLCSSSeveral of these already exist in HTML
The accordion is <details> and <summary>. The modal is
<dialog>. The toggle switch is a checkbox. In each case the browser already handles the
hard part, and reaching for a library means reimplementing it — usually less well.
dialog.showModal() gives you a focus trap, the rest of the page marked inert, Escape to
close, and a top-layer stacking context that sits above everything regardless of z-index. That
last one is the bug that makes hand-rolled modals appear behind a sticky header.
<details name="faq"> makes a group of disclosures exclusive — opening one closes the
others — with no JavaScript at all. And a visually hidden checkbox behind a switch means Tab reaches it,
Space toggles it, and it submits with the form, none of which has to be built.
The details that separate these from the usual versions
:focus-visible, not:focus. A focus ring after a mouse click is what makes designers remove focus rings entirely, which breaks keyboard navigation.:focus-visibleshows it only when it helps, and the argument goes away.- Custom properties for variants. The base class defines two or three variables and each variant redefines them. A new variant is one line, not a copy of the whole rule.
- Never colour alone. Every badge has a word in it, every alert has an icon and a heading, every status has text. Roughly one man in twelve cannot reliably tell your green from your amber.
- Reduced motion is handled. Anything that animates is switched off under
prefers-reduced-motion— but the component stays visible, because removing the indicator entirely is not the accessible version.
Other categories
All of them are free
No attribution, no licence to read. Copy what you need.