---
name: ui-useframe-aa2c8f99ada9
description: Sync UI elements outside the Canvas with the render loop using R3F v10's external useFrame.
---

# UI useFrame

Sync UI elements outside the Canvas with the render loop using R3F v10's external useFrame.

## Technique

Since React Three Fiber v10, `useFrame` can be used outside of the Canvas component. This allows updating DOM elements in sync with the 3D scene without using Drei's Html component.

## Key Concepts

- `useFrame` works outside `<Canvas>` in R3F v10+
- Use refs to manipulate DOM elements directly for performance
- Throttle with `{ fps: N }` option since DOM manipulation is expensive
- Useful for HUDs, debug info, and UI that doesn't need to be in 3D space

## Usage

```tsx
const Ui = () => {
  const ref = useRef<HTMLDivElement>(null)

  useFrame(() => {
    ref.current.innerText = `${position.x.toFixed(2)}, ${position.y.toFixed(2)}`
  }, { fps: 10 })

  return <div ref={ref} className="fixed top-4 right-4" />
}

// Place outside Canvas
<Canvas>
  <Scene />
</Canvas>
<Ui />
```

---

This skill is part of [verekia](https://x.com/verekia)'s [**r3f-gamedev**](https://github.com/verekia/r3f-gamedev).


---
Source attribution: verekia
Original project: https://github.com/verekia/r3f-gamedev/blob/1fec20bc549fb944374084b1a8c33b8ca5a927ef/skills/ui-useframe/SKILL.md
License: MIT
License information: https://opensource.org/license/mit
Original upstream instructions; downloaded from Mega AI Hub.

## Upstream license notice

MIT License

Copyright (c) 2026 Verekia

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.



# Mega AI Hub resource metadata

Creator / publisher: verekia
Original project: https://github.com/verekia/r3f-gamedev/blob/1fec20bc549fb944374084b1a8c33b8ca5a927ef/skills/ui-useframe/SKILL.md
Attribution basis: Source repository record

Fields of work: Design, Development & Engineering
Roles: Frontend Developer, UX Designer
Specialties: Cross Platform, Frontend
Tools: React Three Fiber
Country applicability: Country not specified
Classification basis: Source catalog labels
Instruction SHA-256: 135768ad924ff9c07ee4c92f44e9094288115d26b299bfa0837dd45b3f7f1cb0
