Tailwind Classes Reference
Complete reference for all Tailwind-style utility classes in Whitehall, with equivalent props and generated Kotlin/Compose output.
Prefer classes over props. Classes are faster to write, more scannable, and consistent with web conventions.
Use props only for dynamic/computed values.
<!-- Preferred: class syntax -->
<Column class="p-16 gap-8 items-center bg-primary rounded-lg">
<Text class="text-lg font-bold">Title</Text>
</Column>
<!-- Also works: prop syntax (use for dynamic values) -->
<Column p={dynamicPadding} gap={8}>
<Text>Title</Text>
</Column>
Scale: Classes and props use a 1:1 scale. The number IS the dp value: p-16 = p={16} = 16dp
Override: Props override class values: class="p-4" p={8} results in 8dp padding
Spacing
Padding
| Class | Prop | Compose Output |
|---|
p-{n} | p={n} | .padding(n.dp) |
px-{n} | px={n} | .padding(horizontal = n.dp) |
py-{n} | py={n} | .padding(vertical = n.dp) |
pt-{n} | pt={n} | .padding(top = n.dp) |
pb-{n} | pb={n} | .padding(bottom = n.dp) |
ps-{n} | ps={n} | .padding(start = n.dp) |
pe-{n} | pe={n} | .padding(end = n.dp) |
<Column class="p-16"> <!-- 16dp all sides -->
<Column class="px-16 py-8"> <!-- 16dp horizontal, 8dp vertical -->
<Column class="pt-32 pb-16"> <!-- 32dp top, 16dp bottom -->
Margin
Same pattern as padding (Compose uses outer padding for margin):
| Class | Prop | Compose Output |
|---|
m-{n} | m={n} | .padding(n.dp) |
mx-{n}, my-{n}, etc. | mx={n}, etc. | Same pattern as padding |
Gap
| Class | Prop | Compose Output |
|---|
gap-{n} | gap={n} | Arrangement.spacedBy(n.dp) |
<Column class="gap-16"> <!-- 16dp between children -->
<Row class="gap-8"> <!-- 8dp between children -->
Sizing
Width
| Class | Prop | Compose Output |
|---|
w-{n} | w={n} | .width(n.dp) |
w-full | width="100%" | .fillMaxWidth() |
w-1/2 | width="50%" | .fillMaxWidth(0.5f) |
w-1/3 | width="33%" | .fillMaxWidth(0.333f) |
w-2/3 | width="67%" | .fillMaxWidth(0.667f) |
Height
| Class | Prop | Compose Output |
|---|
h-{n} | h={n} | .height(n.dp) |
h-full | height="100%" | .fillMaxHeight() |
h-1/2 | height="50%" | .fillMaxHeight(0.5f) |
Size (Both)
| Class | Prop | Compose Output |
|---|
size-{n} | size={n} | .size(n.dp) |
<Box class="w-full h-64"> <!-- Full width, 64dp height -->
<Box class="w-1/2"> <!-- 50% width -->
<Box class="size-48"> <!-- 48dp x 48dp -->
Layout (Flex)
Cross-axis Alignment (items)
| Class | Column | Row |
|---|
items-start | Alignment.Start | Alignment.Top |
items-center | Alignment.CenterHorizontally | Alignment.CenterVertically |
items-end | Alignment.End | Alignment.Bottom |
Main-axis Arrangement (justify)
| Class | Compose Output |
|---|
justify-start | Arrangement.Start |
justify-center | Arrangement.Center |
justify-end | Arrangement.End |
justify-between | Arrangement.SpaceBetween |
justify-around | Arrangement.SpaceAround |
justify-evenly | Arrangement.SpaceEvenly |
Weight
| Class | Compose Output |
|---|
flex-1 | .weight(1f) |
flex-grow | .weight(1f) |
<Column class="items-center justify-between">
<Row class="items-center gap-8">
<Box class="flex-1">
| Class | Prop | Compose Output |
|---|
overflow-scroll | scrollable | .verticalScroll(rememberScrollState()) (Column) |
overflow-y-scroll | scrollable="vertical" | .verticalScroll(rememberScrollState()) |
overflow-x-scroll | scrollable="horizontal" | .horizontalScroll(rememberScrollState()) |
<Column class="overflow-scroll p-16">
<Text>Scrollable content...</Text>
</Column>
<Row scrollable>
<Image src="1.jpg" />
<Image src="2.jpg" />
</Row>
Background
Theme Colors
| Class | Compose Output |
|---|
bg-primary | .background(MaterialTheme.colorScheme.primary) |
bg-secondary | .background(MaterialTheme.colorScheme.secondary) |
bg-surface | .background(MaterialTheme.colorScheme.surface) |
bg-error | .background(MaterialTheme.colorScheme.error) |
bg-transparent | .background(Color.Transparent) |
bg-white | .background(Color.White) |
bg-black | .background(Color.Black) |
Hex Colors
| Class | Compose Output |
|---|
bg-[#RRGGBB] | .background(Color(0xFFRRGGBB)) |
Tailwind Palette Colors
Full Tailwind color palette with shades 50-950:
| Class | Hex Value | Compose Output |
|---|
bg-yellow | #EAB308 (yellow-500) | .background(Color(0xFFEAB308)) |
bg-yellow-100 | #FEF9C3 | .background(Color(0xFFFEF9C3)) |
bg-yellow-500 | #EAB308 | .background(Color(0xFFEAB308)) |
bg-yellow-900 | #713F12 | .background(Color(0xFF713F12)) |
bg-blue-500 | #3B82F6 | .background(Color(0xFF3B82F6)) |
bg-red-500 | #EF4444 | .background(Color(0xFFEF4444)) |
bg-green-500 | #22C55E | .background(Color(0xFF22C55E)) |
Available colors: slate, gray, zinc, neutral, stone, red, orange, amber, yellow, lime, green, emerald, teal, cyan, sky, blue, indigo, violet, purple, fuchsia, pink, rose
Available shades: 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950
Opacity Modifier
Use /N suffix (0-100) to apply alpha transparency:
| Class | Compose Output |
|---|
bg-red-500/20 | .background(Color(0x33EF4444)) |
bg-blue/50 | .background(Color(0x803B82F6)) |
bg-white/80 | .background(Color(0xCCFFFFFF)) |
bg-black/10 | .background(Color(0x1A000000)) |
bg-primary/50 | .background(MaterialTheme.colorScheme.primary.copy(alpha = 0.5f)) |
<Box class="bg-primary">
<Box class="bg-[#FF5722]">
<Box class="bg-yellow"> <!-- yellow-500 -->
<Box class="bg-yellow-100"> <!-- light yellow -->
<Box class="bg-red-500/20"> <!-- red at 20% opacity -->
Border Radius
| Class | dp Value | Compose Output |
|---|
rounded-none | 0dp | RoundedCornerShape(0.dp) |
rounded-sm | 2dp | RoundedCornerShape(2.dp) |
rounded | 4dp | RoundedCornerShape(4.dp) |
rounded-md | 6dp | RoundedCornerShape(6.dp) |
rounded-lg | 8dp | RoundedCornerShape(8.dp) |
rounded-xl | 12dp | RoundedCornerShape(12.dp) |
rounded-2xl | 16dp | RoundedCornerShape(16.dp) |
rounded-3xl | 24dp | RoundedCornerShape(24.dp) |
rounded-full | Circle | CircleShape |
Side-specific
| Class | Description |
|---|
rounded-t-{size} | Top corners only |
rounded-b-{size} | Bottom corners only |
rounded-s-{size} | Start corners only |
rounded-e-{size} | End corners only |
<Card class="rounded-lg">
<Box class="rounded-full">
<Card class="rounded-t-xl">
Border
Border Width
| Class | Compose Output |
|---|
border | .border(1.dp, ...) |
border-0 | No border |
border-2 | .border(2.dp, ...) |
border-4 | .border(4.dp, ...) |
Border Colors
| Class | Compose Output |
|---|
border-primary | .border(..., MaterialTheme.colorScheme.primary) |
border-outline | .border(..., MaterialTheme.colorScheme.outline) |
border-white | .border(..., Color.White) |
border-black | .border(..., Color.Black) |
border-yellow | .border(..., Color(0xFFEAB308)) |
border-blue-300 | .border(..., Color(0xFF93C5FD)) |
border-black/10 | .border(..., Color(0x1A000000)) |
<Box class="border-2 border-primary rounded-lg">
<Box class="border border-yellow-300 rounded">
<Box class="border border-black/10"> <!-- subtle border -->
Shadow & Opacity
Shadow (Elevation)
| Class | dp Value | Compose Output |
|---|
shadow-none | 0dp | elevation = 0.dp |
shadow-sm | 2dp | elevation = 2.dp |
shadow | 4dp | elevation = 4.dp |
shadow-md | 6dp | elevation = 6.dp |
shadow-lg | 10dp | elevation = 10.dp |
shadow-xl | 16dp | elevation = 16.dp |
shadow-2xl | 24dp | elevation = 24.dp |
Opacity
| Class | Alpha | Compose Output |
|---|
opacity-0 | 0% | .alpha(0f) |
opacity-25 | 25% | .alpha(0.25f) |
opacity-50 | 50% | .alpha(0.5f) |
opacity-75 | 75% | .alpha(0.75f) |
opacity-100 | 100% | .alpha(1f) |
<Card class="shadow-lg opacity-75">
Safe Area
Handle system UI insets (status bar, navigation bar):
| Class | Prop | Compose Output |
|---|
safe | safeArea | .windowInsetsPadding(WindowInsets.systemBars) |
safe-top | safeTop | .windowInsetsPadding(WindowInsets.statusBars) |
safe-bottom | safeBottom | .windowInsetsPadding(WindowInsets.navigationBars) |
<Column class="safe-top p-16"> <!-- Avoid status bar overlap -->
<Column class="safe"> <!-- Avoid both bars -->
<Column safeTop safeBottom> <!-- Prop syntax -->
Typography
Font Size
| Class | sp Value | Compose Output |
|---|
text-xs | 12sp | fontSize = 12.sp |
text-sm | 14sp | fontSize = 14.sp |
text-base | 16sp | fontSize = 16.sp |
text-lg | 18sp | fontSize = 18.sp |
text-xl | 20sp | fontSize = 20.sp |
text-2xl | 24sp | fontSize = 24.sp |
text-3xl | 30sp | fontSize = 30.sp |
text-4xl | 36sp | fontSize = 36.sp |
Font Weight
| Class | Compose Output |
|---|
font-thin | FontWeight.Thin |
font-light | FontWeight.Light |
font-normal | FontWeight.Normal |
font-medium | FontWeight.Medium |
font-semibold | FontWeight.SemiBold |
font-bold | FontWeight.Bold |
font-extrabold | FontWeight.ExtraBold |
font-black | FontWeight.Black |
Font Style & Decoration
| Class | Compose Output |
|---|
italic | FontStyle.Italic |
not-italic | FontStyle.Normal |
underline | TextDecoration.Underline |
line-through | TextDecoration.LineThrough |
no-underline | TextDecoration.None |
Line Height (Leading)
| Class | Line Height | Description |
|---|
leading-none | 1em | No extra spacing |
leading-tight | 1.25em | Tight spacing |
leading-snug | 1.375em | Snug spacing |
leading-normal | 1.5em | Normal spacing (default) |
leading-relaxed | 1.625em | Relaxed spacing |
leading-loose | 2em | Double spacing |
leading-{n} | n.sp | Fixed sp value |
Text Alignment
| Class | Compose Output |
|---|
text-left | TextAlign.Start |
text-center | TextAlign.Center |
text-right | TextAlign.End |
text-justify | TextAlign.Justify |
Text Color
| Class | Compose Output |
|---|
text-primary | MaterialTheme.colorScheme.primary |
text-secondary | MaterialTheme.colorScheme.secondary |
text-white | Color.White |
text-black | Color.Black |
text-[#RRGGBB] | Color(0xFFRRGGBB) |
text-yellow | Color(0xFFEAB308) |
text-blue-900 | Color(0xFF1E3A8A) |
text-white/80 | Color(0xCCFFFFFF) |
Text Overflow
| Class | Compose Output |
|---|
truncate | overflow = TextOverflow.Ellipsis, maxLines = 1 |
line-clamp-{n} | maxLines = n |
<Text class="text-lg font-bold text-primary">Title</Text>
<Text class="text-sm italic text-center">Subtitle</Text>
<Text class="truncate">Long text that gets cut off...</Text>
<Text class="line-clamp-2">Text limited to 2 lines...</Text>
<Text class="text-lg leading-relaxed">Comfortable reading</Text>
Complete Example
<Column class="p-16 gap-16 bg-surface">
<Text class="text-2xl font-bold text-primary">Welcome</Text>
<Card class="p-16 rounded-lg shadow-md">
<Column class="gap-8">
<Text class="text-lg font-medium">Card Title</Text>
<Text class="text-sm text-secondary line-clamp-2">
Description text that might be long...
</Text>
</Column>
</Card>
<Row class="gap-8 items-center justify-between">
<Button class="flex-1" text="Cancel" />
<Button class="flex-1 bg-primary" text="Submit" />
</Row>
</Column>
See Also