Tailwind CSS 4.3.3•compiled in Rust

Tailwind classes, resolved before they ship

Write className on a Hozo primitive. At build time the compiler turns it into scoped CSS on the Web and a StyleSheet object on iOS and Android. A class it cannot honour on a platform is named in a build diagnostic rather than dropped.

One component, compiled twice

The chips below are Chip.tsx, compiled by this site's own build. Under them is the same file through the Web and Native backends, run when this page was built.

Building for: Web

Chip.tsx

As written.

Chip.tsx
import { Pressable, Text, View } from '@hozo/core'export function Chip({  label,  selected,  onPress,  className,}: {  label: string  selected: boolean  onPress: () => void  className?: string}) {  return (    <View className={className}>      <Pressable        onPress={onPress}        accessibilityRole="checkbox"        accessibilityState={{ checked: selected }}        className={          selected            ? 'px-4 py-2 rounded-full bg-emerald-700'            : 'px-4 py-2 rounded-full border border-stone-500'        }      >        <Text className="text-sm font-semibold text-stone-100 md:text-base">{label}</Text>      </Pressable>    </View>  )}

Web

A button with a scoped class, and the CSS for it.

Web
<div className={["hozo-view", className].filter(Boolean).join(' ').replace(/\S/, 'hozo-candidate-owner $&')}><div className={["hozo-1", (selected) && 'hozo-cond-414-422'].filter(Boolean).join(' ')} role="checkbox" aria-checked={({ checked: selected }).checked} {...hozoInteractive(onPress)}><span className="hozo-2">{label}</span></div></div>@property --tw-leading {  syntax: "*";  inherits: false;}.hozo-1:where(.hozo-cond-414-422) {  border-radius: calc(infinity * 1px);}.hozo-1:not(:where(.hozo-cond-414-422)) {  border-radius: calc(infinity * 1px);  border-top-width: 1px;  border-right-width: 1px;  border-bottom-width: 1px;  border-left-width: 1px;  border-color: oklch(55.3% 0.013 58.071);}:where(.hozo-1:not(:where(.hozo-cond-414-422))) {  border-top-style: solid;  border-right-style: solid;  border-bottom-style: solid;  border-left-style: solid;}.hozo-1:where(.hozo-cond-414-422) {  background-color: oklch(50.8% 0.118 165.612);  padding-inline-start: 16px;  padding-inline-end: 16px;}.hozo-1:not(:where(.hozo-cond-414-422)) {  padding-inline-start: 16px;  padding-inline-end: 16px;}.hozo-1:where(.hozo-cond-414-422) {  padding-top: 8px;  padding-bottom: 8px;}.hozo-1:not(:where(.hozo-cond-414-422)) {  padding-top: 8px;  padding-bottom: 8px;}.hozo-2 {  font-size: 14px;  line-height: var(--tw-leading, 20px);  font-weight: 600;  color: oklch(97% 0.001 106.424);}@media (width >= 768px) {  .hozo-2 {    font-size: 16px;    line-height: var(--tw-leading, 24px);  }}

iOS and Android

A Pressable and a StyleSheet object.

iOS and Android
const __hozoBp_md = useHozoBreakpoint('md')return <View style={hozoClasses(className)}><Pressable style={[(selected) && hozoStyles.hozo1_cond_414_422, (!(selected)) && hozoStyles.hozo1_cond_not_414_422, (selected) && hozoStyles.hozo1_cond_414_422_cascade2, (!(selected)) && hozoStyles.hozo1_cond_not_414_422_cascade2, (selected) && hozoStyles.hozo1_cond_414_422_cascade3, (!(selected)) && hozoStyles.hozo1_cond_not_414_422_cascade3]} role="checkbox" onPress={onPress} accessibilityState={{ checked: selected }}><Text style={[hozoStyles.hozo2, __hozoBp_md && hozoStyles.hozo2_md]}>{label}</Text></Pressable></View>// hozoStyles{  hozo1_cond_414_422: {    borderRadius: 9999,  },  hozo1_cond_not_414_422: {    borderRadius: 9999,    borderTopWidth: 1,    borderRightWidth: 1,    borderBottomWidth: 1,    borderLeftWidth: 1,    borderColor: '#79716b',    borderWidth: 1,  },  hozo1_cond_414_422_cascade2: {    backgroundColor: '#007a55',    paddingStart: 16,    paddingEnd: 16,  },  hozo1_cond_not_414_422_cascade2: {    paddingStart: 16,    paddingEnd: 16,  },  hozo1_cond_414_422_cascade3: {    paddingTop: 8,    paddingBottom: 8,  },  hozo1_cond_not_414_422_cascade3: {    paddingTop: 8,    paddingBottom: 8,  },  hozo2: {    fontSize: 14,    lineHeight: 20,    fontWeight: '600',    color: '#f5f5f4',  },  hozo2_md: {    fontSize: 16,    lineHeight: 24,  },}
A literal

The Text

text-sm font-semibold md:text-base becomes one class and a media query on the Web, and one style plus a breakpoint hook on Native. Nothing is parsed at runtime.

A ternary

The Button

Both branches are compiled. The Web keeps one class and switches a second, hozo-cond-*, beside it; Native picks between two styles.

A value from outside

The View

A className prop cannot be read at build time, and the compiler says so. Its classes come from a stylesheet of every class written literally in the project, or a lookup map on Native. Variants like hover: cannot travel that way on Native.

Variants, platform by platform

Each class compiled on a Hozo Button when this page was built, with the state it depends on where it needs one. A name after "Compiled" is the runtime hook Native uses for it.

Each Tailwind variant and what the Web and Native backends do with it
ClassWebNative
hover:bg-emerald-600CompiledCompiled · HozoPressable
focus-visible:border-emerald-400CompiledCompiled · HozoPressable
active:bg-emerald-800CompiledCompiled
disabled:opacity-50CompiledCompiled
aria-checked:bg-emerald-700CompiledCompiled
dark:bg-stone-800CompiledCompiled · useHozoDark
md:px-6CompiledCompiled · useHozoBreakpoint
motion-reduce:opacity-100CompiledCompiled · useHozoEnvironment
print:hiddenCompiledBuild error`print:` has no React Native equivalent, so the style is not applied there. On Web the same class works from a media query.
before:content-noneCompiledBuild error`content-*`: React Native has no generated content. `::before` and `::after` are boxes the browser makes, and there is nothing here to make one -- this utility is Web-only.
peer-checked:bg-emerald-700CompiledBuild error`peer-checked:` needs a preceding `peer` sibling in the same parent on Native, and none was found. On Web the same class works from the selector.
aria-[sort=ascending]:bg-emerald-700Warning: not compiled yet`aria:` is a Tailwind variant Hozo does not compile yet, so `aria-[sort=ascending]:bg-emerald-700` produces no style. The class is still on the element, so it will work if the project runs its own Tailwind build over it.Warning: not compiled yet`aria:` is a Tailwind variant Hozo does not compile yet, so `aria-[sort=ascending]:bg-emerald-700` produces no style. The class is still on the element, so it will work if the project runs its own Tailwind build over it.

Measured against Tailwind itself

From the conformance snapshot (pnpm --filter @hozo/tailwind-conformance report). On the Web, Tailwind's own compiler is the oracle. On Native nothing defines what p-4 should be, so the question there is only whether each class lowers or is refused out loud.

Web · every class20,222 / 20,222

Every class Tailwind's design system lists (23,286), minus those it emits no standalone CSS for. 0 mismatches.

Web · variants29,403 / 29,403

Single and stacked variants. 0 mismatches.

Web · arbitrary values2,762 / 2,845

0 mismatches; 467 of the matches are compared as text. The rest only mean something beside another class, and are measured in compositions.

Web · rule order22,705 / 22,705

Rules in the candidate stylesheet that keep Tailwind's cascade order.

Native · common classes119 / 124

A hand-picked list of what app code uses. 4 refused, 1 no-op, 0 silent: listed below.

Native · variants14,220 / 21,168

The same 29,403 as the Web, less 8,235 that use a variant with nothing to be on React Native (print:, visited:, before:), refused with a diagnostic. Of the rest, 6,948 refused, 0 silent.

Native · arbitrary values493 / 2,845

2,328 refused with a diagnostic, 0 silent.

Native · refusals checked10,000 / 10,003

Refusals confirmed against React Native's own type definitions; 2 partial, 1 suspect.

The common classes Native does not cover

With what the compiler says when you write them. Grid placement works inside a supported Hozo grid container, as the message says.

REFUSEDgrid-cols-3

grid placement has no standalone React Native style; use it inside a supported Hozo grid container -- this utility is Web-only.

REFUSEDtransition

CSS transitions: React Native has no declarative transition in its StyleSheet -- this utility is Web-only.

REFUSEDduration-200

CSS transitions: React Native has no declarative transition in its StyleSheet -- this utility is Web-only.

REFUSEDease-in-out

CSS transitions: React Native has no declarative transition in its StyleSheet -- this utility is Web-only.

NO-OPwhitespace-normal

React Native's Text wraps by default, so this asks for what it already does.

Your theme, read by Tailwind

Hozo loads your entry stylesheet through Tailwind's own resolver, so @theme, @import and @plugin mean what they mean to Tailwind. Colours come back as oklch() for the Web and as hex for Native, which has no oklch().

Spacing stays a scale

p-4 is four spacing steps, not 16 pixels. Set --spacing and every step moves together, on both platforms.

Every number on this page, and the rest

The conformance page covers StyleX, ARIA roles and the Native component tree too.

See the conformance report →