devup.json
The devup.json file is the configuration file for your Devup UI theme. Create it at the root of your project to define colors, typography, length, shadow, and other design tokens.
Custom prop shorthands are extraction behavior rather than design tokens, so they do not belong in this file. Configure them in the build plugin instead; see Custom Shorthands.
Basic Structure
1{ 2 "theme": { 3 "colors": { 4 "default": {}, 5 "dark": {} 6 }, 7 "typography": {}, 8 "length": { 9 "default": {} 10 }, 11 "shadow": { 12 "default": {} 13 } 14 } 15}1{ 2 "theme": { 3 "colors": { 4 "default": {}, 5 "dark": {} 6 }, 7 "typography": {}, 8 "length": { 9 "default": {} 10 }, 11 "shadow": { 12 "default": {} 13 } 14 } 15}
Complete Example
1{ 2 "theme": { 3 "colors": { 4 "default": { 5 "primary": "#0070f3", 6 "primaryHover": "#0060df", 7 "secondary": "#7928ca", 8 "success": "#0070f3", 9 "warning": "#f5a623", 10 "error": "#e00", 11 "text": "#000", 12 "textMuted": "#666", 13 "background": "#fff", 14 "backgroundMuted": "#fafafa", 15 "border": "#eaeaea" 16 }, 17 "dark": { 18 "primary": "#3291ff", 19 "primaryHover": "#2080ef", 20 "secondary": "#8a63d2", 21 "success": "#3291ff", 22 "warning": "#f7b955", 23 "error": "#f33", 24 "text": "#fff", 25 "textMuted": "#888", 26 "background": "#000", 27 "backgroundMuted": "#111", 28 "border": "#333" 29 } 30 }, 31 "typography": { 32 "h1": [ 33 { 34 "fontFamily": "Pretendard", 35 "fontSize": "32px", 36 "fontWeight": 800, 37 "lineHeight": 1.2 38 }, 39 null, 40 null, 41 null, 42 { 43 "fontFamily": "Pretendard", 44 "fontSize": "48px", 45 "fontWeight": 800, 46 "lineHeight": 1.2 47 } 48 ], 49 "body": { 50 "fontFamily": "Pretendard", 51 "fontSize": "16px", 52 "fontWeight": 400, 53 "lineHeight": 1.5 54 }, 55 "caption": { 56 "fontFamily": "Pretendard", 57 "fontSize": "14px", 58 "fontWeight": 400, 59 "lineHeight": 1.4 60 } 61 } 62 } 63}1{ 2 "theme": { 3 "colors": { 4 "default": { 5 "primary": "#0070f3", 6 "primaryHover": "#0060df", 7 "secondary": "#7928ca", 8 "success": "#0070f3", 9 "warning": "#f5a623", 10 "error": "#e00", 11 "text": "#000", 12 "textMuted": "#666", 13 "background": "#fff", 14 "backgroundMuted": "#fafafa", 15 "border": "#eaeaea" 16 }, 17 "dark": { 18 "primary": "#3291ff", 19 "primaryHover": "#2080ef", 20 "secondary": "#8a63d2", 21 "success": "#3291ff", 22 "warning": "#f7b955", 23 "error": "#f33", 24 "text": "#fff", 25 "textMuted": "#888", 26 "background": "#000", 27 "backgroundMuted": "#111", 28 "border": "#333" 29 } 30 }, 31 "typography": { 32 "h1": [ 33 { 34 "fontFamily": "Pretendard", 35 "fontSize": "32px", 36 "fontWeight": 800, 37 "lineHeight": 1.2 38 }, 39 null, 40 null, 41 null, 42 { 43 "fontFamily": "Pretendard", 44 "fontSize": "48px", 45 "fontWeight": 800, 46 "lineHeight": 1.2 47 } 48 ], 49 "body": { 50 "fontFamily": "Pretendard", 51 "fontSize": "16px", 52 "fontWeight": 400, 53 "lineHeight": 1.5 54 }, 55 "caption": { 56 "fontFamily": "Pretendard", 57 "fontSize": "14px", 58 "fontWeight": 400, 59 "lineHeight": 1.4 60 } 61 } 62 } 63}
Colors Configuration
Define color tokens for each theme variant:
1{ 2 "theme": { 3 "colors": { 4 "default": { 5 "primary": "#0070f3", 6 "text": "#000" 7 }, 8 "dark": { 9 "primary": "#3291ff", 10 "text": "#fff" 11 } 12 } 13 } 14}1{ 2 "theme": { 3 "colors": { 4 "default": { 5 "primary": "#0070f3", 6 "text": "#000" 7 }, 8 "dark": { 9 "primary": "#3291ff", 10 "text": "#fff" 11 } 12 } 13 } 14}
- The first key (
default) is the default theme applied on initial load - Each variant must have the same color token names
- Colors are accessed with the
$prefix:$primary,$text
See Colors for more details.
Typography Configuration
Define typography styles as objects or responsive arrays:
1{ 2 "theme": { 3 "typography": { 4 "heading": { 5 "fontFamily": "Pretendard", 6 "fontSize": "24px", 7 "fontWeight": 700, 8 "lineHeight": 1.3 9 }, 10 "responsiveHeading": [ 11 { "fontSize": "20px", "fontWeight": 700 }, 12 null, 13 null, 14 null, 15 { "fontSize": "32px", "fontWeight": 700 } 16 ] 17 } 18 } 19}1{ 2 "theme": { 3 "typography": { 4 "heading": { 5 "fontFamily": "Pretendard", 6 "fontSize": "24px", 7 "fontWeight": 700, 8 "lineHeight": 1.3 9 }, 10 "responsiveHeading": [ 11 { "fontSize": "20px", "fontWeight": 700 }, 12 null, 13 null, 14 null, 15 { "fontSize": "32px", "fontWeight": 700 } 16 ] 17 } 18 } 19}
Typography properties:
fontFamily- Font family namefontSize- Font size (e.g.,"16px")fontWeight- Weight (number like700or string like"bold")fontStyle- Style (e.g.,"italic")lineHeight- Line height (number like1.5or string like"150%")letterSpacing- Letter spacing (e.g.,"-0.02em")
See Typography for more details.
Length Configuration
Define responsive length tokens for spacing, sizing, and other CSS length properties:
1{ 2 "theme": { 3 "length": { 4 "default": { 5 "containerX": ["16px", null, "32px", null, "64px"], 6 "gutter": ["8px", null, "16px"] 7 } 8 } 9 } 10}1{ 2 "theme": { 3 "length": { 4 "default": { 5 "containerX": ["16px", null, "32px", null, "64px"], 6 "gutter": ["8px", null, "16px"] 7 } 8 } 9 } 10}
Length tokens use responsive arrays just like typography. Use null to skip breakpoints and inherit from the previous value.
See Length for more details.
Shadow Configuration
Define responsive shadow tokens for box-shadow values:
1{ 2 "theme": { 3 "shadow": { 4 "default": { 5 "card": [ 6 "0 1px 2px rgba(0,0,0,0.1)", 7 null, 8 null, 9 "0 4px 8px rgba(0,0,0,0.1)" 10 ], 11 "sm": "0 1px 2px rgba(0,0,0,0.05)" 12 } 13 } 14 } 15}1{ 2 "theme": { 3 "shadow": { 4 "default": { 5 "card": [ 6 "0 1px 2px rgba(0,0,0,0.1)", 7 null, 8 null, 9 "0 4px 8px rgba(0,0,0,0.1)" 10 ], 11 "sm": "0 1px 2px rgba(0,0,0,0.05)" 12 } 13 } 14 } 15}
Shadow tokens also support responsive arrays. Non-array values define a single shadow for all breakpoints.
See Shadow for more details.
Usage in Components
Colors
1<Box bg="$primary" borderColor="$border" color="$text" />1<Box bg="$primary" borderColor="$border" color="$text" />
Typography
1const headingExample = <Text typography="h1">Heading</Text> 2const bodyExample = <Text typography="body">Body text</Text>1const headingExample = <Text typography="h1">Heading</Text> 2const bodyExample = <Text typography="body">Body text</Text>
Length
1<Box gap="$gutter" px="$containerX" />1<Box gap="$gutter" px="$containerX" />
Shadow
1<Box boxShadow="$card" />1<Box boxShadow="$card" />
File Location
The devup.json file should be placed at the root of your project:
your-project/
├── devup.json <-- here
├── package.json
├── src/
│ └── ...
└── ...
Extending Other Files
extends lists other devup.json files to build on, such as a theme shared
across the packages of a monorepo:
1{ 2 "extends": ["../../shared/devup.json"], 3 "theme": { 4 "colors": { 5 "default": { 6 "primary": "#0070f3" 7 } 8 } 9 } 10}1{ 2 "extends": ["../../shared/devup.json"], 3 "theme": { 4 "colors": { 5 "default": { 6 "primary": "#0070f3" 7 } 8 } 9 } 10}
- Paths are file paths relative to the file that lists them, not package names. An extended file may extend others in turn.
- The files merge in order: the first entry is the base, each later entry overrides it, and the file itself is applied last.
- Objects merge key by key, so the example keeps every color the shared file
defines and replaces only
primary. Arrays, such as responsive values andbreakpoints, are replaced as a whole. - A path to a file that does not exist adds nothing. The build warns, naming the file that extends it and the missing path, and picks the file up once it is created.
- Files that extend each other in a loop are an error naming the chain.
The development servers of the Vite, webpack, Rsbuild and Next.js plugins reload the theme when any file of the chain changes.
Plugin Configuration
By default, plugins look for devup.json in the project root: Vite's root,
webpack's context, Rsbuild's root, the Next.js project directory (webpack
builds; Turbopack builds use the working directory) or the root of
Bun.build. Relative devupFile, distDir and
cssDir paths resolve against it, not against the directory a monorepo tool
(turbo, nx, ...) starts the build from. If devupFile is not set and only the
working directory holds a devup.json, that file is still used and a one-time
warning asks you to move it into the project root or set devupFile.
You can customize the path:
Vite
1import { DevupUI } from '@devup-ui/vite-plugin' 2 3export default defineConfig({ 4 plugins: [ 5 DevupUI({ 6 devupFile: 'config/devup.json', // custom path 7 }), 8 ], 9})1import { DevupUI } from '@devup-ui/vite-plugin' 2 3export default defineConfig({ 4 plugins: [ 5 DevupUI({ 6 devupFile: 'config/devup.json', // custom path 7 }), 8 ], 9})
Next.js
1const { DevupUI } = require('@devup-ui/next-plugin')
2
3module.exports = DevupUI(
4 {
5 // your Next.js config
6 },
7 {
8 devupFile: 'config/devup.json', // custom path
9 },
10)
1const { DevupUI } = require('@devup-ui/next-plugin')
2
3module.exports = DevupUI(
4 {
5 // your Next.js config
6 },
7 {
8 devupFile: 'config/devup.json', // custom path
9 },
10)
Type Generation
When your project builds, Devup UI automatically generates TypeScript types from your devup.json. This enables:
- Autocomplete for color, typography, length, and shadow tokens
- Type errors for invalid tokens
- Consistent usage across your codebase
The types are generated at <distDir>/theme.d.ts. distDir is a build-plugin
option (not a devup.json field) and defaults to df, so the default path is
df/theme.d.ts (the Bun plugin always uses df). If your tsconfig.json limits include, add df/*.d.ts (or
the matching custom distDir).
Hot Reload
Changes to devup.json trigger hot reload during development. You can:
- Add new color tokens
- Modify existing values
- Add typography, length, or shadow styles
And see changes immediately without restarting the dev server.