Feed
shadcn-htmx/feedFreeComponent
A role="feed" container of <article> items that loads more as the user scrolls (htmx infinite scroll via hx-trigger="revealed"), following the WAI-ARIA APG Feed pattern. A structure, not a widget — screen readers stay in reading mode.
Live preview
live · rendered by the registry
Rendered by shadcn-htmx on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://shadcn-htmx.productdevbook.com/r/feed.jsonSource
1/** @jsxImportSource hono/jsx */2import type { PropsWithChildren } from "hono/jsx"3import { cn, type ClassValue } from "@/registry/lib/cn"45// Feed — shadcn-htmx, htmx v4 + Tailwind v4.6//7// shadcn/ui has no "feed" component (it's a structural ARIA pattern, not a8// widget), so there's no React source of truth to mirror. We build it9// straight from the WAI-ARIA APG Feed pattern:10// repos/aria-practices/content/patterns/feed/feed-pattern.html11// repos/aria-practices/content/patterns/feed/examples/feed-display.html12// repos/aria-practices/content/patterns/feed/examples/js/feed.js13// (the PageUp/PageDown + Ctrl+Home/End reference implementation our14// site.js keyboard contract is modelled on)15//16// Why this shape:17// - A feed is a STRUCTURE, not a widget. Screen readers stay in reading18// mode; the role="feed" container establishes an interoperability19// contract for reliably loading content as the user scrolls (APG20// "About This Pattern"). So the container is a plain <div role="feed">,21// NOT focusable.22// - Each unit of content is a real <article> (which already maps to23// role="article" per the HTML AAM — we set role="article" explicitly to24// stay faithful to the APG example markup and defensive against older AT).25// repos/mdn/files/en-us/web/html/reference/elements/article/index.md26// - Each article is focusable (tabindex="0") so AT reading cursors can land27// on it and the page can scroll it into view (APG: the article containing28// the reading cursor must contain DOM focus).29// - aria-posinset / aria-setsize position each article in the set; setsize30// can be -1 when the total is unknown (infinite feed). APG roles/states.31// - aria-labelledby names each article from its title; aria-describedby32// points at the primary content so AT users can skim.33// - aria-busy on the feed flips true while a batch is loading and false34// once the DOM is stable. APG: "extremely important that aria-busy is set35// to false when the operation is complete." With htmx the busy attribute36// rides on the freshly-swapped placeholder, so it's only present during37// the in-flight request.38//39// htmx infinite scroll (verified against v4):40// repos/htmx/www/src/content/patterns/01-loading/02-infinite-scroll.md41// repos/htmx/www/src/content/reference/01-attributes/06-hx-trigger.md#revealed42// The trailing sentinel uses hx-trigger="revealed" + hx-get + hx-swap=43// … truncated
More from shadcn-htmx
All 83 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | shadcn-htmx | Components | Free | no deps | |
| Active Searchactive-search | shadcn-htmx | Components | Free | no deps | |
| Alertalert | shadcn-htmx | Components | Free | no deps | |
| Alert Dialogalert-dialog | shadcn-htmx | Components | Free | no deps | |
| Aspect Ratioaspect-ratio | shadcn-htmx | Components | Free | no deps | |
| Auto Gridauto-grid | shadcn-htmx | Components | Free | no deps | |
| Autocompleteautocomplete | shadcn-htmx | Components | Free | no deps | |
| Autosize Textareaautosize-textarea | shadcn-htmx | Components | Free | no deps |
