Skip to content
Proyectos

Acerca de

☕️ Un conjunto de componentes de interfaz de usuario habituales creados únicamente con CSS y sin JavaScript.

Desarrollo web y de aplicaciones

Cómo se miden estas cifras

Crecimiento de estrellas medido

in 24h
0
in 7 days
+1
in 15 days
+2
in 1 month
Recopilando historial

Cambios netos en períodos que se solapan, no totales diarios. Los datos no disponibles se dejan en blanco. Las estrellas indican interés, no calidad.

README.md

Original
Pure CSS Components

Pure CSS Components

Netlify Status license

UI components built with HTML and CSS only. Zero JavaScript, in 2014 and today.

See the components · Why

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.

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 server
  • pnpm build: type-check and build to dist
  • pnpm lint: lint scripts and styles

Each component lives in its own folder:

  • src/exhibits/<name>/then.*: the 2014 original
  • src/exhibits/<name>/now.*: the native version
  • src/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

Explorar proyectos relacionados

Cargando…