Skip to main content

Guides

Density

Density is how much room a screen gives its spacing: a compact screen fits more on it, a roomy one reads more easily. Ouro UI takes density from one variable, Tailwind's --spacing, and keeps fixed sizes apart from it, so a compact app does not shrink its icons and avatars with its gaps.proof

What follows density

Gaps, padding and margins follow --spacing: gap-3 and py-2 are multiples of it.spacing A row's height follows it too when padding sets that height, as a ConversationList row's does, so a compact app tightens its rows.proof

What doesn't

Fixed sizes read --ouro-size-* variables instead. They are defined in ouro-base.css in rem, a quarter rem per step: --ouro-size-8 is 2rem, and a dot in the step is written as an underscore, as in --ouro-size-2_5. Components size those parts with the named utilities ouro-base registers for them, such as size-ouro-8, which read their tokens. --spacing does not change them.tokens

The fixed parts that use them today are an avatar's box, an avatar group's "+N" count, a conversation row's icon, mark and more button, and the coarse pointer's 44px target.floor Avatar, AvatarGroup, ConversationList and the components converted since read the tokens; the others still size some fixed parts with spacing classes until their own changes land.

Floors

A row or control a finger touches stays at least 44px tall at every density, so the target is the same size on a phone whatever the app's --spacing is.floor It is set with min-h-ouro-11, which reads --ouro-size-11, not with spacing.

On a fine pointer, a control whose height follows --spacing stays at least its icon plus 4px tall, so a compact app never squeezes a button under its icon. The floor is one pointer-fine:min-h-ouro-* class per control, as Button sets it.

Set density and a fixed size in your app

Set --spacing in an unlayered :root rule after your theme, to make a screen compact:

:root {
  --spacing: 0.2rem;
}

Set a --ouro-size-* variable the same way to theme one fixed size. This one makes the small avatar larger:

:root {
  --ouro-size-8: 2.25rem;
}

Claim sources