data-* & dataset Playground

Rara’s student card on the teacher’s board: your data-* attributes read and written through a real el.dataset. What comes back for a kebab-case name, for a…

Why it matters

data-* is used for event delegation (a data-id on every row), state-based styling ([data-state="open"]) and component config. Reading the wrong name (kebab vs camel) or forgetting to convert the type is a subtle, common bug.

The key idea

Names turn camelCase, values are always strings

Common mistakes

Try it in this playground