r/reactjs • u/ChrisTerya • 15d ago
Show /r/reactjs Foldable phone support for React: hinge detection and two-pane layouts in ~2 kB
A recent audit I ran showed 94% of popular sites split a button across a foldable's hinge (https://christophe77.github.io/fold.js/study.html).
So I made u/foldjs/react: a hook that give you the hinge position and posture (flat, book, tabletop), plus a two-pane layout component that never puts content under the hinge. It ships with a built-in simulator, so you can work on it without owning a Fold.
Demo (works on desktop): https://christophe77.github.io/fold.js/
I'd love feedback on the API, especially from anyone who has shipped foldable layouts in production.
1
u/mylaptopisnoasus 15d ago
Are people browsing the internet in partially folded state?
1
u/Nenada_Maryjimz 10d ago
Does this wrap the native CSS viewport segments API under the hood, or is it doing its own detection logic? Curious how consistent browser support is across different foldable devices right now