matthewhudson/current-device
📱 The easiest way to write conditional CSS and/or JavaScript based on device operating system (iOS, Android, Blackberry, Windows, Firefox OS, MeeGo), orientation (Portrait vs. Landscape), and type (Tablet vs. Mobile). observed · 2026-08-28
Health v2 · maintenance only
84/100
- Activity 86
- Release rhythm 72
- Longevity 100
How is this computed?
round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10) — computed 2026-09-03. Adoption (stars, forks) is never an input.
- gap_med: 0
- age_days: 5096
- days_rel: 189
- days_push: 86
- n_releases_24m: 2
Adoption not part of the score
3927 stars · 576 forks observed · 2026-08-28
What it is AI-extracted, prompt v1, taxonomy v1, 2026-08-29, confidence not recorded
A lightweight JavaScript/TypeScript library that detects the device's operating system, type (mobile/tablet/desktop), and orientation, exposing a simple JS API and automatically adding conditional CSS classes to the <html> element. It supports iOS, Android, Blackberry, Windows, macOS, Firefox OS, MeeGo, and more.
Use cases
- detect if user is on mobile or tablet in javascript
- apply conditional css based on device operating system
- detect portrait vs landscape orientation in browser
- add device-specific css classes to html element
- serve different styles for ios vs android
- run mobile-specific javascript logic
- detect device type in typescript
When to choose
- you need simple client-side device detection with zero configuration
- you want both a JavaScript API and automatic CSS classes from one small library
- you need orientation change callbacks for responsive behavior
- you want TypeScript types included out of the box
When to avoid
- you need server-side or user-agent-string-based detection with detailed device metadata
- you only need responsive layouts, which CSS media queries handle natively
- you require feature detection rather than device detection
- you need detection of specific browsers or browser versions
Facets
library · maturity active
ui-components developer-tools web-development frontend mobile-development browser device-detection css-classes responsive-design user-agent mobile-web typescript javascript nodejs
3 sources
- readme: https://github.com/matthewhudson/current-device · fetched 2026-08-28 · 4bcb1ae2efee
- homepage: https://matthewhudson.github.io/current-device/ · fetched 2026-08-29 · b0aadf60acf1
- registry_npm: https://registry.npmjs.org/current-device · fetched 2026-08-29 · 864117ea8567
Member repositories
| Repository | Role | Health v2 |
|---|---|---|
| matthewhudson/current-device | main | 84 |
For agents
markdown · JSON · MCP: product_card(name="matthewhudson/current-device")
Data as of 2026-08-30T08:39:29.467469+00:00 · Report a problem