Write 16 once. AppDimens makes it look the right size on phones, tablets, foldables, TVs, desktops, the web, embedded displays — and in games on every platform.
When you build an app, you write sizes like "padding 16" or "text 18". The problem: 16 looks fine on a phone, tiny on a tablet and almost invisible on a TV.
AppDimens fixes that. Instead of 16.dp you write 16.sdp (or sdp(16), or 16sdp, depending on your platform). The library looks at the screen the app is running on and adjusts the number for you — automatically, every time the screen changes (rotation, split screen, folding).
You write: 16.sdp
Phone → 19 dp ✅ comfortable
Tablet → 38 dp ✅ same proportion
TV → 58 dp ✅ still readable
- ✅ Same names on every platform —
sdp,ssp,asdp… mean the same thing on Android, iOS, Flutter, React Native, Web, .NET, Qt, GTK, LVGL, Roku, Python and in games. - ✅ Production-ready — every library below is published and stable.
- ✅ Tiny and fast — a calculation takes a few nanoseconds.
- ✅ Free and open source — Apache 2.0.
Tip
Too long, didn't read: pick your platform in the table below, install one package, replace 16.dp with 16.sdp and 16.sp with 16.ssp. Done.
A 48 dp button on different screens:
| Approach | Phone (360 dp) | Tablet (720 dp) | TV (1080 dp) | Result |
|---|---|---|---|---|
Plain dp / sp / pt / px |
48 (13% of the screen) ✅ | 48 (6.7%) ❌ tiny | 48 (4.4%) ❌ lost | Same number, shrinks visually |
| Simple proportional scaling | 58 (16%) ✅ | 115 (16%) ❌ huge | 173 (16%) ❌ giant | Grows too much |
AppDimens auto |
58 (16%) ✅ | 88 (12%) ✅ | 98 (9%) ✅ | Grows, but calmly — looks right everywhere |
Every platform has its own repository (linked below). This repository is the hub: it brings them all together and explains the shared ideas.
| I'm building with… | Library | Version | Install | Start here |
|---|---|---|---|---|
| Android — Jetpack Compose, Kotlin, Java | appdimens-dynamic | 3.2.0 | implementation("io.github.bodenberg:appdimens-dynamic:3.2.0") |
Beginner guide |
Android — XML layouts (@dimen/_16sdp) |
appdimens-sdps | 3.2.0 | implementation("io.github.bodenberg:appdimens-sdps:3.2.0") |
README |
Android — XML text sizes (@dimen/_14ssp) |
appdimens-ssps | 3.2.0 | implementation("io.github.bodenberg:appdimens-ssps:3.2.0") |
README |
| Kotlin Multiplatform — Android, iOS, desktop, web | appdimens-kmp | 3.2.0 | implementation("io.github.bodenberg:appdimens-kmp:3.2.0") |
Beginner guide |
| Apple — iOS, iPadOS, macOS, tvOS, watchOS, visionOS (SwiftUI, UIKit) | appdimens-ios | 3.2.0 | Swift Package Manager: https://github.com/bodenberg/appdimens-ios from 3.2.0 |
Beginner guide |
| Flutter — Android, iOS, web, desktop | appdimens-flutter | 3.2.0 | flutter pub add appdimens_flutter |
Beginner guide |
| React Native — iOS & Android | appdimens-react-native | 3.2.0 | npm install appdimens-react-native |
Docs |
| Web — HTML/CSS, React, Vue, Svelte, Angular | appdimens-web (npm webdimens) |
3.2.1 | npm install webdimens |
Getting started · PT-BR |
| .NET — MAUI, WPF, WinForms, WinUI 3, .NET for Android | appdimens-net-binding | 3.6.1 | dotnet add package Bodenberg.AppDimens.Maui.Sdps |
Docs |
| Qt — Widgets & QML, Qt 5.12+ / Qt 6 (Windows, macOS, Linux, Android, iOS, embedded) | appdimens-qt | 3.2.0 | CMake add_subdirectory(appdimens-qt) → AppDimens::Qt · qmake appdimens-qt.pri |
README |
| GTK — GTK 3 / GTK 4 (C, PyGObject, GJS, Vala, Rust) + portable C99 core | appdimens-gtk | 3.2.0 | meson setup build -Dgtk=4 · pkg-config appdimens-gtk4 |
README |
| LVGL — v8.3 / v9 on MCUs and embedded Linux (ESP32, STM32, RP2040, Zephyr…) | appdimens-lvgl | 3.2.0 | ESP-IDF component · PlatformIO bodenberg/appdimens-lvgl · Arduino · CMake |
README |
| Roku — BrightScript / SceneGraph channels (FHD, HD, SD coordinate spaces, 10-foot UI) | appdimens-roku | 3.2.0 | copy source/AppDimens*.brs into the channel |
README |
| Python — Tkinter, PySide/PyQt, Kivy, pygame, pyglet, wx, Dear PyGui, Panda3D, Blender | appdimens-py | 3.2.0 | pip install appdimens · Blender add-on zip |
README |
| Games — Unity, Unreal Engine 5, Godot 4, custom C/C++ engines, .NET engines, Android; Windows, Linux, Steam Deck, Proton, macOS, iOS, Web, consoles; OpenGL, Vulkan, Direct3D 11/12, Metal, WebGPU; FSR, DLSS, XeSS | appdimens-games | 3.3.0 | Unity UPM · UE5 plugin · Godot addon · CMake native/ · implementation("io.github.bodenberg:appdimens-games:3.3.0") |
Engines · Beginner guide |
Note
All libraries are in production. Android, KMP and Games (Android) are on Maven Central, Flutter on pub.dev, React Native and Web on npm, .NET on NuGet, iOS via Swift Package Manager, Python on PyPI, LVGL on the ESP-IDF / PlatformIO / Arduino registries; Qt, GTK and the game-engine packages build from source (CMake, Meson, Unity UPM, Unreal and Godot plugins). Each repository's README is the final word on its install line.
The same idea — 16 of spacing, 18 of text — on each platform:
Android (Compose) · Kotlin Multiplatform
import com.appdimens.dynamic.compose.* // KMP: com.appdimens.kmp.compose.*
Text("Hello", fontSize = 18.ssp, modifier = Modifier.padding(16.sdp))Android (XML) — with appdimens-sdps + appdimens-ssps
<TextView
android:padding="@dimen/_16sdp"
android:textSize="@dimen/_18ssp" />iOS (SwiftUI)
import AppDimensDynamic
Text("Hello").font(.system(size: 18.ssp)).padding(16.sdp)
// Install once per window: ContentView().appDimens()Flutter
import 'package:appdimens_flutter/appdimens.dart';
Padding(padding: EdgeInsets.all(16.sdp), child: Text('Hello', style: TextStyle(fontSize: 18.ssp)));
// Wrap your app once: AppDimensApp(child: MaterialApp(...))React Native
import { sdp, ssp } from 'appdimens-react-native';
<Text style={{ padding: sdp(16), fontSize: ssp(18) }}>Hello</Text>Web
<!-- No build step: the CDN script installs itself -->
<script src="https://cdn.jsdelivr.net/npm/webdimens@3.2.1/dist/webdimens.global.js"></script>
<p class="p:16sdp fs:18ssp">Hello</p>
<!-- With npm: import { install } from 'webdimens'; install(); -->.NET MAUI (XAML)
<Label Text="Hello" Padding="{sdp:16}" FontSize="{ssp:18}" />Qt (QML)
import AppDimens 1.0
Text { text: "Hello"; font.pixelSize: AppDimens.ssp(18); padding: AppDimens.sdp(16) }GTK (C)
AppDimensScope *ad = appdimens_scope_new_for_widget(window);
appdimens_scope_add_css(ad, "label { padding: 16sdp; font-size: 18ssp; }");LVGL
lv_appdimens_init(NULL);
lv_obj_set_style_pad_all(label, lv_ad_sdp(16), 0);Roku (BrightScript / SceneGraph)
card.width = sdp(720) ' like sdp(16) on the Web; reads ui_resolutions (FHD, HD, SD)
font.size = AppDimens().fontSize(32) : pad = cdp(16, "brand") ' custom strategyPython / Blender
import appdimens as ad
pad, text = ad.sdp(16), ad.ssp(18) # Blender: appdimens_blender.region_dimens(context.region)Games (Unity · Unreal · Godot · C/C++)
float hud = adg_ref_px(&m, AD_AUTO, 320); // 320 px at 1080p → right size at 720p, 4K, 21:9, Steam DeckMore complete, copy-paste examples for every platform: DOCS/EXAMPLES.md.
A strategy is just the rule used to grow a size. You choose it by the name you type. Most people only ever need the first two:
| If your app… | Use | Example | What it does |
|---|---|---|---|
| Runs mostly on phones (the normal case) | scaled | 16.sdp, 16.ssp |
Grows in proportion to the screen. |
| Runs on phones and tablets/TVs | auto ⭐ | 16.asdp, 16.assp |
Grows normally on phones, then slows down on big screens. |
| Needs a size that is a % of the screen | percent | 16.psdp, 10.spaceW |
Literal percentage of width/height. |
| Needs text between a minimum and a maximum | fluid | 16.fsdp, 16.fssp |
Grows only inside a band (like CSS clamp()). |
| Targets very large TVs | logarithmic | 16.logsdp |
Grows very slowly. |
| Is a game or canvas | fit / fill | 16.ftsdp, 16.flsdp |
Letterbox (never crop) or cover (always fill). |
| Needs real-world sizes | units | 10.mm, 1.inch |
Physical millimetres, centimetres, inches. |
There are 14 strategies in total (also power, interpolated, diagonal, perimeter, density, resize). They are all explained in plain language in the Beginner guide.
Handy letters you can add at the end of any name:
| Ending | Meaning | Example |
|---|---|---|
a |
Also consider the screen shape (long/wide screens) | 16.sdpa |
i |
Ignore split-screen/multi-window | 16.sdpi |
Px |
Give me pixels instead of dp/points | 16.sdpPx |
Ph, Lw… |
Switch the measured side when the device rotates | 32.sdpPh |
sdp = scales with the smallest side of the screen · wdp = with the width · hdp = with the height · ssp = for text (respects the user's font size) · sem = for text that ignores the user's font size.
Every code library (Android, KMP, iOS, Flutter, React Native, Web, .NET, games) has a new custom module: write the rule yourself, in one line, with autocomplete — or keep it as text in a JSON file shared by all your apps and platforms.
val Product = CustomScaleStrategy { (width / 360f).coerceIn(0.85f, 1.80f) } // factor × every value
val Hud = scalingFormula { base * pow(sw / 360f, 0.8f) } // final value (base = 16)
Modifier.padding(16.cdp(Product))Same names and same numbers on Android, KMP, iOS, Flutter, React Native, Web, .NET and games. Not available in the Android XML resource libraries (appdimens-sdps / appdimens-ssps), which offer only the scaled strategy. DOCS/CUSTOM.md shows the syntax on each platform, the shared JSON format and links to every library's guides.
A skill is a set of instructions that teaches AI coding assistants (Claude Code, Codex, Gemini CLI, Cursor, Copilot, Windsurf…) how to use AppDimens correctly.
⭐ Easiest: install them all with one command — appdimens-skills
npx appdimens-skillsThe installer finds the AI tools on your computer and the platforms in your project, and asks what to install. Your assistant then:
- figures out which screen the design was made for (e.g. the Figma frame size),
- understands what each element should do (list, grid, card, fixed line…),
- picks the right AppDimens library, strategy and value, and
- checks its own work after each edit (a built-in validator).
It covers every AppDimens library and four workflows: from Figma, from Claude Design, converting existing screens, and creating new screens. Claude Code users can also install it as a plugin: /plugin marketplace add bodenberg/appdimens-skills.
Each library also ships its own skill with the detailed API:
| Where | Skill |
|---|---|
| All libraries, one installer | appdimens-skills (npx appdimens-skills) |
| This hub (routes to the right library) | skills/SKILL.md |
| Android Compose | appdimens-dynamic/skills |
| Kotlin Multiplatform | appdimens-kmp/skills |
| iOS | appdimens-ios/skills/appdimens-ios |
| Flutter | appdimens-flutter/skills |
| React Native | appdimens-react-native/skills |
| Web | appdimens-web/skills |
| .NET | appdimens-net-binding/skills (4 skills: SDPS, AppDimens.Net, Android XML, Android Dynamic) |
| Qt | appdimens-qt/skills |
| GTK | appdimens-gtk/skills |
| LVGL | appdimens-lvgl/skills |
| Roku | appdimens-roku/skills |
| Python / Blender | appdimens-py/skills |
| Games | appdimens-games/skills |
For AI tools that read a summary file, see LLMS.txt.
| I want to… | Read |
|---|---|
| Get started step by step | DOCS/GUIDE.md |
| Copy working code | DOCS/EXAMPLES.md |
| See the same feature on every platform | DOCS/PLATFORMS.md |
| Upgrade from an older version | DOCS/MIGRATION.md |
| Handle rotation and foldables | DOCS/ORIENTATION.md |
| Understand the math | DOCS/THEORY.md |
| Write my own scaling rule (custom strategies) | DOCS/CUSTOM.md |
| See pictures and comparisons | IMAGES/README.md · interactive comparison |
| Read the papers (PDF) | Precision scaling · Android · UI · Beyond DP |
Does it work for games outside Android? Yes. appdimens-games 3.3 ships a Unity package, an Unreal Engine 5 plugin, a Godot 4 addon, a .NET package and a portable C/C++ SDK — Windows, Linux, Steam Deck, Proton, macOS, iOS, Web and consoles; OpenGL, Vulkan, Direct3D 11/12, Metal and WebGPU; FSR, DLSS, XeSS, MetalFX and TSR presets.
Embedded displays and desktop toolkits? Yes: LVGL (integer-only hot path for MCUs without FPU), Qt (Widgets/QML), GTK (3/4), Roku TV channels (BrightScript/SceneGraph) and Python (Tkinter, PySide, Kivy, pygame, Blender).
Do I need to learn math to use it? No. Replace dp with sdp and sp with ssp. The math is there if you are curious (THEORY.md).
What is a "design base"? Sizes are designed for a reference phone 300 units wide. On that phone 16.sdp is exactly 16. Wider screens get proportionally more.
Does it respect the user's font-size accessibility setting? Yes — ssp does. Use sem only when text must not follow it (e.g. inside a fixed badge).
Will it slow my app down? No. Values are cached; one lookup costs a few nanoseconds (performance report).
Does it work with rotation, split screen and foldables? Yes, values update automatically. Add i (16.sdpi) if a value must ignore split screen.
XML or Compose on Android? Both. appdimens-sdps/appdimens-ssps give ready-made @dimen resources for XML; appdimens-dynamic is for Compose and code. Many apps use both.
Can I mix platforms in one design system? Yes — that's the point. A designer's "16 sdp" means the same on Android, iOS, Flutter, React Native, Web and .NET.
Where do I report a bug? In the repository of the library you use (e.g. appdimens-flutter issues). Problems with this hub's docs → hub issues.
This hub includes every library as a Git submodule (a link to another repository, pinned to its latest version).
appdimens/ ← you are here (the hub: docs + shared ideas)
├── DOCS/ ← guides, examples, theory, migration
├── skills/ ← hub AI skill (routes to the right library)
├── appdimens-dynamic/ ← Android Compose / Kotlin / Java
├── appdimens-sdps/ ← Android XML sizes
├── appdimens-ssps/ ← Android XML text sizes
├── appdimens-kmp/ ← Kotlin Multiplatform
├── appdimens-ios/ ← Apple platforms
├── appdimens-flutter/ ← Flutter
├── appdimens-react-native/ ← React Native
├── appdimens-web/ ← Web (npm: webdimens)
├── appdimens-net-binding/ ← .NET (MAUI, WPF, WinForms, WinUI, Android)
├── appdimens-qt/ ← Qt 5/6 — Widgets & QML
├── appdimens-gtk/ ← GTK 3/4 + portable C99 core
├── appdimens-lvgl/ ← LVGL v8/v9 (MCUs, embedded Linux)
├── appdimens-roku/ ← Roku BrightScript / SceneGraph
├── appdimens-py/ ← Python (Tk, Qt, Kivy, pygame…) + Blender add-on
├── appdimens-games/ ← Games: Unity, Unreal, Godot, C/C++, .NET, Android — every platform & graphics API
└── appdimens-skills/ ← AI assistant skills for every library (npx appdimens-skills)
Clone everything:
git clone --recurse-submodules https://github.com/bodenberg/appdimens.git
# already cloned? bring every library to its latest version:
git submodule update --init --remoteOnly need one platform? Just use that library's repository directly.
- CONTRIBUTING.md — how to help.
- SECURITY.md — how to report a vulnerability.
- CODE_OF_CONDUCT.md — community rules.
- CHANGELOG.md — history of the hub and coordinated releases.
- LICENSE — Apache 2.0.
AppDimens é uma família de bibliotecas que faz os tamanhos da sua interface (espaçamentos, botões, textos) ficarem do tamanho certo em qualquer tela — celular, tablet, dobrável, TV, desktop e web.
- Como usar: troque
16.dppor16.sdpe16.sppor16.ssp. A biblioteca ajusta o valor sozinha para a tela atual. - Celular + tablet/TV no mesmo app? Use
16.asdp/16.assp(estratégia auto): cresce normalmente no celular e desacelera em telas grandes. - Todas as bibliotecas estão em produção, na versão 3.2.0 (Web na 3.2.1, .NET na 3.6.1, Games na 3.3.0).
- Novas plataformas: Qt (Widgets/QML, Qt 5 e 6), GTK (3 e 4), LVGL (microcontroladores, sem FPU), Roku (BrightScript/SceneGraph), Python (Tkinter, PySide, Kivy, pygame e Blender).
- Jogos em todas as plataformas:
appdimens-games3.3 atende Unity, Unreal Engine 5, Godot 4, engines próprias em C/C++ e .NET — Windows, Linux, Steam Deck, Proton, macOS, iOS, Android, Web e consoles; OpenGL, Vulkan, DirectX 11/12, Metal e WebGPU; presets de FSR, DLSS, XeSS, MetalFX e TSR; FOV para ultrawide; jogos 2D, pixel art, 3D, FPS, mundo aberto e AAA. - Escolha sua plataforma na tabela 📦 Pick your platform — cada uma tem guia para iniciantes.
- Nenhuma estratégia serve? O novo módulo custom deixa você escrever a sua própria regra em uma linha, com autocomplete (
CustomScaleStrategy { (width / 360f).coerceIn(0.85f, 1.8f) }), ou em texto num JSON compartilhado entre apps e plataformas — veja DOCS/CUSTOM.md. - Mesmos nomes em todas as plataformas:
sdp,ssp,asdp… significam a mesma coisa no Android, iOS, Flutter, React Native, Web e .NET. - Assistentes de IA: rode
npx appdimens-skillspara instalar as skills de todas as bibliotecas no seu Claude Code, Codex, Cursor, Copilot etc. (appdimens-skills). Cada biblioteca também traz a sua skill; a skill do hub está emskills/SKILL.md.
Jean Bodenberg — @bodenberg · appdimens-project.web.app
If AppDimens helps you, please ⭐ this repository and the libraries you use.
