# Remotion Rule: Measuring Dom Nodes > Remotion skill rule: Measuring DOM element dimensions in Remotion. Part of the official Remotion Agent Skill for programmatic video in React. ## Install Save the content below to `.claude/skills/` or append to your `CLAUDE.md`: ## Quick Use ```bash npx skills add remotion-dev/skills ``` This rule activates automatically when working with measuring dom nodes in a Remotion project. --- ## Intro Measuring DOM element dimensions in Remotion. Part of the [Remotion AI Skill](https://tokrepo.com/en/workflows/57997ead-c8fa-409c-916f-28bbc0adc8d9) — the official Agent Skill for programmatic video creation in React. **Best for**: Developers using Remotion for measuring dom nodes **Works with**: Claude Code, OpenAI Codex, Cursor --- ## Rule Content # Measuring DOM nodes in Remotion Remotion applies a `scale()` transform to the video container, which affects values from `getBoundingClientRect()`. Use `useCurrentScale()` to get correct measurements. ## Measuring element dimensions ```tsx import { useCurrentScale } from "remotion"; import { useRef, useEffect, useState } from "react"; export const MyComponent = () => { const ref = useRef(null); const scale = useCurrentScale(); const [dimensions, setDimensions] = useState({ width: 0, height: 0 }); useEffect(() => { if (!ref.current) return; const rect = ref.current.getBoundingClientRect(); setDimensions({ width: rect.width / scale, height: rect.height / scale, }); }, [scale]); return
Content to measure
; }; ``` --- ## Source & Thanks > Created by [Remotion](https://github.com/remotion-dev). Licensed under MIT. > [remotion-dev/skills](https://github.com/remotion-dev/skills) — Rule: `measuring-dom-nodes` Part of the [Remotion AI Skill](https://tokrepo.com/en/workflows/57997ead-c8fa-409c-916f-28bbc0adc8d9) collection on TokRepo. --- Source: https://tokrepo.com/en/workflows/eebf5616-36b0-4c9b-8ae3-64a46d81ae8c Author: TokRepo Curated