addEventListener
Listen for clicks the idiomatic way.
Short tagged patterns — HTML, CSS, JavaScript, React, and Web Components to paste and adapt.
Trail
Tags
Listen for clicks the idiomatic way.
Line that grows with transform — light and accessible.
Open Shadow DOM and inject markup + CSS.
Native modal with showModal().
Project light DOM into the shadow with <slot>.
queryKey + queryFn.
submit, button, and reset with clear intent.
Light elevation for content blocks.
Use the tag in JSX after registering the element.
Side-effect import + tag in a Vue template.
Absolute center of a child in the container.
place-items centers on a single grid axis.
Compact tag group with automatic wrap.
Multiline cut with -webkit-line-clamp.
Toggle visual state via classList.
Open/close a mobile menu.
Content slot in the component.
&& and ternary in JSX.
Create and insert DOM nodes.
Encapsulated styles with :host and ::slotted.
Hint on hover/focus using attr() and a pseudo-element.
Custom look while keeping the native input accessible.
Option group with consistent look and visible focus.
Register a Custom Element with a hyphenated name.
Read data-* as camelCase.
Delay execution until the user pauses.
Avoid errors if the module is imported twice.
Clean signature with destructuring.
Native disclosure without JavaScript.
Named class + register() + auto-register.
async/await with an ok check.
Section that escapes the column and fills 100vw.
Function that returns JSX.
Frosted glass with backdrop-filter.
Fill text with linear-gradient via clip.
Hide nav, buttons, and ads with @media print.
Fill the frame without distortion — smart crop.
Explicit for/id association.
List with a stable identifier.
Keep 16:9 (or another) without padding hacks.
Essential viewport for mobile layout.
A clean start without wiping the whole UA stylesheet.
React to HTML attribute changes.
Basic meta tags for social previews.
exports field pointing at the lib ESM.
Responsive image via media query.
Rounded label for status and tags.
Cancel default submit or navigation.
Base CTA style with hover.
Iterate a NodeList with forEach.
Accessible visually hidden (sr-only).
Style based on component width.
Animated placeholder while content loads.
Skip navigation and jump to content.
Anchors with native animated scrolling.
Replace manual margins with gap in flex/grid.
Footer at the bottom of the viewport even with little content.
Keep the bar at the top while scrolling.
Human-readable date with machine-readable value.
Ellipsis when text overflows the width.
Empty deps array + cleanup.
Mutate and refresh the cache.
Boolean with a functional setter.
Light/dark theme base with custom properties.
:focus-visible state without removing accessibility.
vite.config snippet for library mode.
create + selector.