Attribute-based TV remote navigation controller for web apps. Initialize once and control focus, enter, and back actions using HTML attributes.
npm install tvcontroller-javascriptA lightweight focus management library for Smart TV apps. Navigate with remote controls using simple HTML attributes.




``bash`
npm install tvcontroller-javascript
`javascript
import { tvController } from "tvcontroller-javascript";
tvController().init();
`
`css`
.tv-focused {
border: 3px solid #ff0000;
transform: scale(1.1);
transition: all 200ms ease;
}
`html`
| Attribute | Description |
|-----------|-------------|
| tv-focus="true" | Makes element focusable |tv-enter="..."
| | Runs on OK/Enter press |tv-focused="..."
| | Runs when focused |tv-back="..."
| | Runs on Back press |
`html`

`html`HomeMoviesSettings
`html`
`css
/ Glow effect /
.tv-focused {
box-shadow: 0 0 20px rgba(255, 0, 0, 0.8);
}
/ Slide effect /
.tv-focused {
transform: translateX(10px) scale(1.05);
}
``
- Arrow Keys: Navigate
- Enter/OK: Select
- Back: Go back
Samsung Tizen, LG webOS, Android TV, Fire TV, and more.
MIT
---
⭐ Star us on GitHub if you find this useful!
From AnarLabs❤️