show-when: a Web Component that conditionally shows or hides HTML content based on browser environment state.
Key features:
- URL query parameter matching (key or key=value)
- Hash-based visibility with live
hashchangereaction - CSS feature detection via
CSS.supports() - Media query matching with live updates
- Network status detection (online/offline)
- A companion
hide-whenelement for inverted logic
Great for progressive enhancement, debug panels, offline notices, browser compatibility messages, and locale-based content blocks. No framework required.
Full setup guide, examples, and attribute reference: [https://www.cssscript.com/conditional-content-visibility-show-when/]
Top comments (0)