Frontend Recipes
Typed fetch with timeout
Official Bits example. A generic JSON fetch wrapper that cancels slow requests with AbortController and surfaces HTTP errors.
typescriptaborthttpfetch
001
Dark mode with light-dark()
Official Bits example. Theme tokens that follow the operating system preference, with a reduced-motion safeguard.
CSSthemingaccessibilitydark-mode
000
Native dialog modal
Official Bits example. A modal built on the native dialog element with a labelled heading, form controls and browser-managed focus.
accessibilityHTMLformsdialog
000
Container query card grid
Official Bits example. A responsive card grid that reacts to its container width instead of the viewport.
container-querieslayoutCSSresponsive
000
Lazy reveal with IntersectionObserver
Official Bits example. Reveal elements once as they enter the viewport, then stop observing them to keep scrolling cheap.
domjavascriptperformanceanimation
000