current-device is a device detection library that adds CSS classes and JavaScript methods to identify the user's device operating system, orientation, and type.
The tool solves the problem of writing device-specific conditional logic without complex user-agent parsing. It works by detecting device characteristics at runtime and injecting CSS classes into the HTML element, while also exposing JavaScript methods for programmatic checks. This approach lets developers target specific devices, orientations, and form factors directly in stylesheets or JavaScript without maintaining fragile detection logic themselves.
The library supports a broad range of devices including iOS, Android, BlackBerry, Windows, macOS, Firefox OS, MeeGo, and AppleTV, detecting both device type (mobile, tablet, desktop, television) and orientation (portrait, landscape). It ships with built-in TypeScript types and can be installed via npm or included directly through a CDN script tag. This makes it suitable for projects that need to adapt layouts or behavior across diverse device ecosystems, particularly those targeting both mobile and desktop users where orientation changes matter.
The project maintains a stable, focused scope with no indication of rapid churn or experimental directions. Development appears steady without signs of abandonment or major architectural upheaval.