Chakra Rem-to-Units Helper
May 27, 2025 ยท View on GitHub
Convert rem values into Chakra UI spacing units with smart completions in VS Code.
โจ Features
- ๐ Instantly convert
remvalues to Chakra spacing units - โก Smart inline completions as you type
- ๐ง Supports decimals like
1.5rem,2.25rem - ๐งฉ Works in JavaScript, TypeScript, HTML, CSS, and React files
- โ
Minimal syntax required โ just type
rc3, pressCtrl+Space, and select the suggestion
Cursor must be at starting line when pressing Ctrl+Space, if you write rc2 the cursor whould be behind the "r".
๐ก Usage
Just type a value like this:
rc2
Then trigger completions (e.g. Ctrl+Space), and you'll see suggestions like:
8 (chakra units, 2rem = 8 chakra size tokens)
It will replace the full matched text (rc2, rc3, etc.) with the equivalent Chakra value (e.g., 8, 12).
๐ง Chakra Calculation Logic
This extension assumes:
1rem = 16px- Chakra spacing unit base =
4px
So:
rem2 โ (2 _ 16) / 4 = 8
rem1.5 โ (1.5 _ 16) / 4 = 6
๐ Supported Languages
- JavaScript
- TypeScript
- JavaScript React (
.jsx) - TypeScript React (
.tsx) - HTML
- CSS
๐ฆ Installation
- Search for Chakra Rem-to-Units Helper in the Extensions tab
- Click Install
- Start typing
remXorrcXin your files - Trigger completions with
Ctrl+Space
๐งช Example
Before:
padding: rem2;
After:
padding: 8;
๐ค Contributions
PRs and issues welcome!
ยฉ 2025 โ Chakra Rem-to-Units Helper