/modern-html:modern-html-js-replacement-patternsfrom modern-html
Replace JS UI libs with native HTML/CSS — modal, tooltip, popover, dropdown, accordion, tabs, carousel, sticky, smooth-scroll, form-validation, lazy-load, line-clamp. Use when: replacing/evaluating Floating UI, Popper, Headless UI, Radix, Reach, Tippy, Swiper, GSAP, Framer Motion, IntersectionObserver libs; building UI primitives; removing JS from frontend. Skip: backend code, non-UI domain.
Ships in modern-html. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
宗旨:先原生,後 JS。每模式查階後施。
<dialog> + showModal()。勿 自造 role="dialog" div。<details><summary>。獨開組 → <details name="g">。<img loading="lazy" decoding="async" width height>。position: sticky; top: 0。html { scroll-behavior: smooth }。守 prefers-reduced-motion.required pattern type=email + :user-valid / :user-invalid。line-clamp: N(or legacy -webkit-line-clamp for Safari)。<input type=range> 驅 --p var, clip-path: inset(...)。<details> 或 [hidden] 或 :has(:checked)。color-scheme: light dark + light-dark(a,b) + prefers-color-scheme.| 模式 | 原生 | 階 | JS 仍需 |
|---|---|---|---|
| Modal | <dialog>+showModal() | 甲 | 多步嚮導;非模 stack 管 |
| Tooltip (click) | popover attr | 乙 | hover-delay (Interest Invoker 未發) |
| Tooltip (hover delay) | 無 | 乙/丙 | 是 — 須 JS 至 Interest Invoker 發 |
| Dropdown / Menu | popover + anchor | 乙 | 虛擬 1k+ 項;shadow-DOM 隔;嵌套動加載 |
| Accordion (獨立) | <details> | 甲 | 幾乎不需 |
| Accordion (互斥) | <details name> | 乙 | 幾乎不需 |
| Tabs | 無原生 | — | 是 — 須完整 ARIA tablist + 箭頭鍵 + roving tabindex。可降級為 <details name> |
| Carousel | scroll-snap | 甲 | ::scroll-button 未跨瀏 |
| Carousel buttons/dots | ::scroll-button ::scroll-marker | 丙 (Chrome only) | 是 — 跨瀏需 |
| Sticky header | position: sticky | 甲 | 滾向動隱顯需 JS 或 scroll-driven (丙) |
| Smooth scroll | scroll-behavior | 甲 | 自定 ease |
| Custom scrollbar | scrollbar-color/width/gutter | 乙/甲 | 漸變每元 iOS |
| Show/hide | <details> [hidden] :has(:checked) | 甲/乙 | 進出動需 @starting-style (乙) |
| Form validate | constraint API + :user-valid | 甲/乙 | 跨欄;server echo |
| Lazy load | loading="lazy" | 甲 | 元件級 IO 邏輯 |
| Image compare | range + clip-path | 甲 | 雙軸對比 |
| Theme switch | color-scheme + light-dark() | 乙 | 用戶 toggle vs 系統 → 屬性切換 [data-theme=dark] |
| Scroll animation | animation-timeline | 丙 (Firefox 未) | 是 — IO fallback 必 |
| Page trans (SPA) | startViewTransition() | 乙 | 路由數據依賴 |
| Page trans (MPA) | @view-transition | 丙 (Firefox 未) | 是 — instant fallback |
| Counter / number anim | counters; @property --num | 乙 | 貨幣 / locale |
| Resizable panels | resize: both + CQ | 甲 | localStorage 持久 |
| Truncate | line-clamp | 甲/乙 | "Read more" 重排 |
| Sticky thead | thead th { position: sticky } | 甲 | collapsed table quirks |
| Virtual scroll | content-visibility: auto | 乙 | 真海量 (10k+) 需 recycle |
<dialog>:必 aria-labelledby 或內含標題。勿 加 role="dialog"。aria-describedby 至 trigger,須手加。<summary> 已報 disclosure role,勿覆 ARIA。role="tablist|tab|tabpanel" + 箭鍵 + roving tabindex。@media (prefers-reduced-motion: no-preference) 之內 (opt-in)。詳見 native-html-primitives/SKILL.md § Anti-Patterns。
references/decision-matrix.md — 全表細注。modern-html:baseline-decision-protocol — 前置 Tier A/B/C 閘;先判可用層,再取此技各特性。What SKILL.md sets; muted values are Claude Code's defaults
"replacing JS UI library, building modal/tooltip/dropdown/menu/accordion/tabs/carousel/sticky/scroll-effect/form-validation, removing dependencies"
Other plugins' skills for the same job
10 skills in this plugin
/modern-html-accessibility-primitivesNative a11y primitives — focus-visible, focus-within, inert, prefers-reduced-motion, prefers-color-scheme, prefers-contrast, forced-colors, accessibility-tree for dialog/popover/anchor-positioning, ARIA labeling. Use when: focus styles, keyboard nav, animating UI, picking colors, modal/popover content, auditing component a11y. Skip: backend code, non-rendered content./modern-html-baseline-decision-protocolBaseline-tier decision tree for HTML/CSS/DOM Tier A Widely-9mo auto-adopt, Tier B Newly prompt, Tier C Limited avoid sans fallback. Use when: writing CSS/HTML, picking UI pattern, replacing JS lib, choosing layout/animation primitive, before popover/dialog/container-queries/anchor-positioning/view-transitions/scroll-driven-animations/color-mix/oklch/:has(). Skip: non-UI code./modern-html-css-architecturenpx claudepluginhub standardbeagle/standardbeagle-tools --plugin modern-html