felipefialho/css-components
소개
☕️ JavaScript 없이 CSS의 힘만으로 구현한 공통 UI 컴포넌트 모음입니다.
웹 및 앱 개발측정된 스타 증가
- in 24h
- 0
- in 7 days
- +1
- in 15 days
- +2
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalPure CSS Components
UI components built with HTML and CSS only. Zero JavaScript, in 2014 and today.
In 2014, a modal, a carousel or a set of tabs meant a jQuery plugin. This project built them with no JavaScript at all, storing their state in hidden checkboxes, radio buttons and the URL hash. A lot of people shipped them to production.
Twelve years later, the browser does it natively. <details>, <dialog>, invoker commands, the Popover API, anchor positioning and CSS carousels turned those hacks into real, accessible platform features. So the idea is relevant again, and the site now shows both sides.
What's inside
Then and now
Each of the six original components, working as it was written in 2014, next to the way HTML and CSS build it natively today.
| Component | 2014 | Today |
|---|---|---|
| Carousel | Radio inputs + labels | scroll-snap, ::scroll-button(), ::scroll-marker |
| Collapse | Hidden checkbox / radios | <details name>, ::details-content |
| Dropdown | Hidden checkbox, :hover |
Popover API, anchor positioning, interestfor |
| Modal | Hidden checkbox | <dialog>, commandfor, @starting-style |
| Tab | Radio inputs | Exclusive <details name> laid out as tabs |
| Tooltip | :hover + ::after |
popover="hint", interestfor, anchor positioning |
Born native
Components with no 2014 version. No hidden input could fake them, and until recently each one needed a script.
- Custom select:
appearance: base-select,::picker(select) - Switch and segmented control:
<input switch>,:has() - Smarter forms:
field-sizing: content,:user-invalid - File tree: nested
<details> - Filters drawer:
<dialog closedby>, invoker commands - Sticky header: scroll-state container queries
- Scroll-spy table of contents:
scroll-target-group,:target-current - Reading progress: scroll-driven animations
- Radial menu:
sibling-index(),sibling-count() - Gallery: cross-document view transitions
Some of these features are new. Every exhibit lists where it works today, and browsers without support get a plain version that still works.
Principles
- Zero JavaScript. Not in the components, not on the site. It works with JavaScript turned off.
- Honest support. Every native feature shows its real browser support.
- Progressive enhancement. New features sit behind
@supports, so nothing breaks where they are missing. - Accessible by default. The native versions use real elements with focus, keyboard and screen reader support built in.
Using the code
Each component shows its HTML and CSS on the site, ready to copy. The 2014 originals are kept for history: if you are building something today, use the native versions.
The original Stylus sources and zip downloads are in the v2.0.0 release.
Running locally
Requires Node.js 22.12+ and pnpm. Built with Astro.
pnpm install
pnpm dev
pnpm dev: start the dev serverpnpm build: type-check and build todistpnpm lint: lint scripts and styles
Each component lives in its own folder:
src/exhibits/<name>/then.*: the 2014 originalsrc/exhibits/<name>/now.*: the native versionsrc/exhibits/born/<name>/demo.*: born native components
Support
If this project helped you, back then or today, you can sponsor my work on GitHub.
License
MIT License © Felipe Fialho
관련 프로젝트 살펴보기
불러오는 중…