惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Vercel News
Vercel News
O
OpenAI News
Engineering at Meta
Engineering at Meta
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
月光博客
月光博客
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
WordPress大学
WordPress大学
宝玉的分享
宝玉的分享
GbyAI
GbyAI
T
The Blog of Author Tim Ferriss
Google DeepMind News
Google DeepMind News
B
Blog RSS Feed
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
云风的 BLOG
云风的 BLOG
罗磊的独立博客
S
SegmentFault 最新的问题
The Register - Security
The Register - Security
Hugging Face - Blog
Hugging Face - Blog
D
DataBreaches.Net
U
Unit 42
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
B
Blog
阮一峰的网络日志
阮一峰的网络日志
P
Proofpoint News Feed
雷峰网
雷峰网
V
Visual Studio Blog
小众软件
小众软件
aimingoo的专栏
aimingoo的专栏
N
Netflix TechBlog - Medium
酷 壳 – CoolShell
酷 壳 – CoolShell
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Y
Y Combinator Blog
博客园 - 【当耐特】
G
Google Developers Blog
L
LangChain Blog
Stack Overflow Blog
Stack Overflow Blog
I
InfoQ
Martin Fowler
Martin Fowler
F
Fortinet All Blogs
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
The Cloudflare Blog
AI
AI
Google Online Security Blog
Google Online Security Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
博客园 - Franky
Blog — PlanetScale
Blog — PlanetScale
Webroot Blog
Webroot Blog
PCI Perspectives
PCI Perspectives
爱范儿
爱范儿
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org

Adam Argyle

WWW Ep248 Live At React Miami With Guests Jason Lengstorf And Kent C Dodds And Tanner Linsley And Francesco Cuilla · June 25, 2026 WWW Ep247 Live At React Miami With Ken Wheeler · June 20, 2026 Contextualism Talk At CSS Day 2026 · June 12, 2026 WWW Ep246 AI Harnesses Framework Wars And Why Beards Beat Mustaches · June 11, 2026 CSS Day 2026 · June 8, 2026 A Standard Site · June 5, 2026 WWW Ep245 The Death Of Typing With Typecraft At React Miami · June 5, 2026 Time To MC Cascadia JS · June 1, 2026 Flex Wrap Balance · May 30, 2026
Prop For That · June 13, 2026
Adam Argyle · 2026-06-14 · via Adam Argyle

Announcing Prop For That, a JS library that backfills what CSS doesn't provide us yet (and maybe never will).

I'm done waiting for CSS to catch up to all the valuable information JS knows and done watching folks write the same little JS to just write a custom property to a component.

demo · docs · npm

Here's a basic example taking the value from a range slider to draw a nice gradient that fills up the slider:

import 'prop-for-that/auto'
// or import 'https://esm.sh/prop-for-that/auto'
<input type="range" data-props-for="range" min="0" max="100" value="40" />
input[type="range"] {
  background: linear-gradient(
    to right in oklab,
    var(--theme) calc(var(--live-value-pct) * 100%),
    var(--track) 0
  );
}

codepen · docs example · codepen collection

Why? #

It's super common to need a few lines of JS for a simple thing like:

  • the value of the color input
  • the mouse pointer position
  • the size of the scrollbar
  • the colors present in an image or video
  • the battery level
  • an element's visibility
  • etc

With Prop For That, you just declaratively specify on any element the props you want, and live props show up.

There's an imperitive API too, but the data attribute path is the slickest

Everything is a plugin that loads only if you need it too, ultimately putting you right where you wanted to be: creating something sick in CSS using dynamic information without wiring up some dorky JS.

What kind of props? #

My talk at CSS Day was an enumeration of all the ways CSS can adapt to users, contexts, pages, etc… which made me hyper aware of all the ways CSS couldn't adapt without JS.

Here's a flat list of all the live props currently supported by the library:

  1. Pointer x/y in the window
  2. Pointer x/y inside/local to an element
  3. Viewport pixel height/width values
  4. Visual viewport information
  5. Element size information
  6. Element visibility
  7. Scrollbar and thin scrollbar sizes
  8. Input element values
  9. Input element dirty, touched, pristine, etc
  10. Select element value, index, count, etc
  11. Colors from an image or gradient (average, accent, light, dark, etc)
  12. Colors occuring in a video
  13. Video progress
  14. Image loaded or broken + natural h/w
  15. Clock time
  16. FPS
  17. Online/offline status
  18. Page focused/visible
  19. Scroll velocity
  20. Accelerometer and device tilt/orientation
  21. Geolocation
  22. DPR, CPU cores, memory
  23. Page navigation type (reload, back, etc)

And a few Chromium only props:

  1. Network status like type, speed, save data, etc
  2. Battery status
  3. CPU pressure

Style Queries #

Style Queries being in all major browsers marks an important milestone for CSS, and made this library much more viable.

Using Prop For That with Style Queries looks like this:

import 'https://esm.sh/prop-for-that/auto'
<form data-props-for="form-state">
  <input name="name" required>
  <input name="email" type="email" required>
  <button type="submit">Save</button>
</form>
@container style(--live-all-valid: 1) {

}

Bye noise #

Import, add attribute(s), have CSS fun.

Go make cool shit and share it with me 🤘🏻💀

13 comments #

📣 Prop For That An a-la-carte #JS library for #CSS that writes meaningful realtime CSS variables to an element: - value of an input - pointer position - size of scrollbar(s) - colors in an image/video - element's visibility - tons more… now there's a prop for that 🙂

Adam ArgyleAdam Argyle

Thanks for this! Such wonderful little tool; I’ll share it with my team.

Amir R MuntasserAmir R Muntasser

@argyleink This is such an elegant bridge! Exposing pointer position and scroll size as CSS custom props unlocks pure CSS effects that previously needed JS listeners scattered everywhere. The image color extraction prop is especially 🤯 — theming components from their own content.

Claudio CavalliClaudio Cavalli

@argyleink Hi Adam, the idea and execution are all super cool, but the website prop-for-that.netlify.app consistently crashes after 15-20 seconds in my Firefox Developer Edition 152.0b10 (aarch64)

Angelika CathorAngelika Cathor

@angelikatyborska well poo, cuz it's got lots of optimizations so it's not wasteful, i wonder where the leak is (sounds like a leak to me at least)

you're also on dev edition, have flags enabled at all? does it repro on stable?

Adam ArgyleAdam Argyle

What is the performance impact of changing css variables?

Manuel MeisterManuel Meister

Depends on where they change and where they’re used

Adam ArgyleAdam Argyle

@argyleink Execution reveals what theory obscures.

RahulRahul

@argyleink This is incredible! Would love to toss in one more for consideration, on screen keyboard geometry. Imho one of the harder ones to get right, mainly because Safari but even really good fixed layout in edge to edge in chrome is pretty challenging.

CallieCallie

@calinoracation oh hell yeah, great idea. https://t.co/Ke1nzBBn3S

Adam ArgyleAdam Argyle

@argyleink Amazing, you rock!

CallieCallie

@argyleink very cool, although I can hear my CPU fan spin up when I do any interaction on the demo page :P

Mabi19Mabi19