Supported Syntax & Limitations
Devup UI compiles styles at build time and ships no styling runtime. Whatever the build can know is compiled; whatever it cannot know is either kept as a CSS variable on an element or reported as a build error with the file, line, column, the code and what it needs instead. Nothing is silently dropped, and the output is the same on every build.
This page lists what compiles, what stays as written, and where the limits are.
Supported at build time
| Pattern | Result |
| --------------------------------------------------------------- | ------------------------------------------------------------------------ |
| Style props with literals, theme tokens and constants | Static classes |
| Style props with runtime values (props, state) | A class reading a CSS variable set in style |
| Responsive arrays, _hover and other selectors, both combined | Classes per breakpoint and selector |
| Conditions (a ? b : c, a && b, a \|\| b, a ?? b) | One class per branch, chosen at runtime |
| Constants declared with const, in the file or imported | Read as written, including objects, arrays, enums and computed constants |
| css(), globalCss(), keyframes() | Static CSS; values must be known at build time |
| styled() in every spelling, .attrs(), as, withComponent | A component rendering its tag with static classes |
| styled-components / Emotion theme reads (p.theme.a.b) | var(--a-b), set by ThemeProvider |
| Emotion css prop, <ClassNames>, jsx, JSX runtime pragmas | Compiled to className and style |
| Component selectors (${Child} { ... }, [Child]) | A short marker class on the selected component |
| vanilla-extract style, globalStyle, keyframes | Static CSS |
| StyleX create, props, attrs, defineVars, createTheme | Static CSS, merged key by key |
| Tailwind v4 classes in className | Static classes; unknown classes stay as written |
Style override rules
When styles the build knows are composed, a later part replaces an earlier one for the same property, selector, breakpoint and layer, as it would at runtime in the original library. This holds for:
css(a, b)and Emotion'scx(a, b)with classes the file binds tocss()styled(Base)extending a styled component the file defines, and.attrs()- vanilla-extract
style([a, b]), StyleXprops(a, b) - JSX spreads followed by explicit props, and the Emotion
cssprop with aclassName
Responsive values are always written after non-responsive ones, so a breakpoint value overrides the base value regardless of where the classes land in the stylesheet.
Where the cascade decides
Some composition only happens at runtime, so the build cannot merge it. There the result follows CSS specificity and stylesheet order, not the order the code wrote the parts in:
- a
classNamepassed in through props, an external class (CSS Modules, a design system) or a class string built at runtime, joined with Devup UI classes - a
styled()base the build cannot read (alet, a function result, a component from another package), which keeps wrapping it - unknown spread props, which pass through as written
- StyleX arguments the build cannot read key by key (namespaces from other modules,
include())
When the winner matters, pass the variation as a prop, a variant (cond ? a : b) or a styled() extension the file defines, so the build sees both sides.
Browser support
The generated CSS targets Baseline 2024: it uses light-dark() for color themes, @layer for cascade layers and :is() for group selectors. Older browsers that lack these features are not supported.
The css prop on your own components
The Emotion css prop compiles to className and style. A component of your own that takes the prop receives those two props instead, so it must pass both on to the element it renders:
1function Card({ className, style, children }) { 2 return ( 3 <div className={className} style={style}> 4 {children} 5 </div> 6 ) 7} 8 9const example = <Card css={{ color: 'red', padding: width }} />1function Card({ className, style, children }) { 2 return ( 3 <div className={className} style={style}> 4 {children} 5 </div> 6 ) 7} 8 9const example = <Card css={{ color: 'red', padding: width }} />
A dynamic value such as width becomes a CSS variable set in style, so a component that drops style loses it.
Runtime-only APIs
| API | Behavior |
| --------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
| ServerStyleSheet, StyleSheetManager, CacheProvider | Accepted and inert; Devup UI writes a real stylesheet at build time. CacheProvider ignores value |
| stylis plugins (stylisPlugins) | A build error on StyleSheetManager or createCache(); there is no stylis pass at build time |
| StyleSheetManager shouldForwardProp, namespace | A build error; use .withConfig({ shouldForwardProp }) per component, and write the scope yourself |
| shouldForwardProp on props the build cannot name | Evaluated at build time only: a prop a spread or caller passes reaches the element even if rejected |
| @emotion/css cache, flush, hydrate, sheet | Stay on @emotion/css; they work on styles inserted at runtime |
| @emotion/css/create-instance | A build error while @emotion/css is aliased; import css, cx and the rest from @emotion/css |
| @emotion/react ThemeContext, withEmotionCache, * as | A build error while @emotion/react is aliased; import what Devup UI compiles by name |
| ThemeProvider | Declares the variables it changes on a display: contents <div>; the outermost one on :root too |
| jest-styled-components, @emotion/jest, React Native targets | Not supported |
| vanilla-extract recipes, sprinkles | A build error however they load (import, re-export, require(), import()) while aliased |
| vanilla-extract dynamic | A build error while @vanilla-extract/css is aliased; use a style prop |
Known limitations
- An exported styled component carries one short marker class (
a--b) when it is compiled, even when no selector in its own file names it. A module importing it may select it (${Child} { ... }) or extend it, and each file is built without knowing which files import it, so the class has to be on the element from the start. A one-shot production build with the Vite or webpack plugin (including Next.js without Turbopack) takes it off again once every module is compiled: the start-of-build scan reports what each file it reads selects, each transform reports what its module selects, and a marker that neither lists, and that no module wrote itself, leaves the output chunks. When a module selects a component but the scan never read it (a virtual module; a file another tool compiles first, such as MDX; a file loaded throughrequire.context,import.meta.globor a computedimport()whose arguments the scan cannot read; or a file outside the scanned roots and entries, such as one only a functionentryreaches), the build keeps every marker and warns, naming each such module and the reason. Dev servers, watch builds, Turbopack and the Rsbuild and Bun plugins keep every marker. A styled component the file keeps to itself (not exported) carries a marker only when a selector in that file names it, so a private component that is only rendered or extended there carries none. - A class,
keyframesname or styled component defined in another module is not read as a build-time value: its name is only known once that file is built. Declare it in the file that uses it, or read it from a style prop. css(),globalCss()andkeyframes()have no element to set a CSS variable on, so a runtime value there is a build error. Move it to a style prop.- A styled-components or Emotion style function may read the theme only as
theme.a.b(ortheme.a[2]). Calls, whole-theme reads and runtime keys are build errors. - CSS variables need an element to live on, so a
ThemeProvidergiven athemerenders a<div style="display: contents">around its children (one without athemerenders none). It stays out of layout, but it is still an element: it is invalid where only certain children are allowed (inside<table>,<tr>,<select>,<ul>), and it sits between a parent and its children for>,+,:first-childand similar selectors. Put the provider outside such structures. - A theme key becomes part of a CSS variable name (
theme.a.bis--a-b), soThemeProviderthrows on a key that cannot be (such as'brand color'), on two paths giving the same variable ({ a: { b } }and'a-b'), and on a theme that contains itself.nullandundefinedvalues declare nothing. - Inside
<ClassNames>,cx(getClass())is a build error; put the result in a variable first, which then joins as a class. withComponenttakes a tag name or a component written as a name ora.b. On a component made with Devup UI's or styled-components'styled, a target only the runtime knows, aswithComponent(make()), is a build error: such a component compiles to a plain function with nowithComponent. Pass the target directly, or render withas. A component made with Emotion'sstyledtakeswithComponentat runtime as well, so any one target works there. Options passed beside the target are a build error.- An
.mdxfile is extracted after your MDX plugin compiles it to JavaScript, never as raw MDX. The Vite (@mdx-js/rollup), webpack and Rsbuild (@mdx-js/loader,@rsbuild/plugin-mdx) plugins and Next.js with webpack (@next/mdx) run their MDX step in a later phase: Vite in aposttransform, webpack and Rsbuild in apostloader. Next.js with Turbopack (@next/mdx) extracts the compiled document:@next/mdxrenames its output to.tsxand Turbopack runs the source rule on it again, so it works whichever ofwithMDXandDevupUIwraps the other. A production Turbopack build cannot extract a document before it compiles, so its stylesheet waits for the MDX route files (whenpageExtensionslistsmdx) and the documents they and the compiled sources import by a relative path; a document imported only through a path alias is not waited for. The Bun plugin does not extract MDX yet. The scan that reserves class names before a build reads JavaScript and TypeScript modules only, so a document's own classes are named when it compiles. Put components that need Devup UI styles in a.tsxmodule and use them from the document. - With Turbopack, Next.js copies its resolved config into
.next/required-server-files.{js,json}and the standaloneserver.js, so the two Devup UI loader rules (about 500 bytes, the same for any app size, with no local path) ship with the server output. They cannot be removed safely today: Next.js copies the config before any hook the plugin can register runs, and its only option that leaves bundler settings out of that copy also changes how the server reads its deployment id (vercel/next.js#102045). Webpack builds add nothing there. - The plugins read
jsxImportSourcefrom thetsconfig.json(orjsconfig.json) in the working directory. Opt out withimportAliases: { '@emotion/react/jsx-runtime': false }. - The outermost
ThemeProvideralso declares its theme on:root, in a<style>element rendered before its<div>, socreateGlobalStyleand<Global>rules onhtml,bodyor:rootread it; a nested provider changes only its own subtree. Several outermost providers side by side all write:root, and the last one in the document wins there. The<style>element also counts in thetextContentof what holds the provider. - The Bun plugin compiles
.ts,.mts,.cts,.tsx,.jsx,.mjs,.jsand.cjsfiles, ES modules and CommonJS alike, under the runtime as inBun.build;require()andimportkeep the exports of a CommonJS module. Insidenode_modulesit compiles the.jsand.cjsfiles of@devup-uipackages and of the packages listed in itsincludeoption only. A Bun runtime plugin must return the source of every file it matches, and Bun runs that source as an ES module, so under the runtime the plugin runs a CommonJS module itself and hands Bun an ES module that exports itsmodule.exports. - Code that only the runtime can compute — other globals,
Date,Math.random,new, classes, async code — is never run by the build; on an element it stays a CSS variable, elsewhere it is a build error.
Build errors
Every build error names where it is and what the build needs:
src/App.tsx:6:18: `css()` cannot use `width` at build time: its values must be literals, theme tokens or constants, or be computed from them
src/Card.tsx:3:36: `css` on `<div>` cannot use `getStyles()` at build time: it must be a style object, CSS text, a class `css()` gives, or a function of the theme giving one, or an array or condition of them
A file with several problems reports them all at once, in source order.
See Build Errors for the build errors, grouped by API.