Duolith docs

0017. Add hover, and md and lg window-size prefixes at 768px and 1024px

  • Status: Proposed
  • Date: 2026-11-14
  • Decided by: Mik
  • Planning item: WP7 part 1 (styling and themes)

Context

Apps compiled to the web are used with a mouse and in wide windows; native apps run on phones and tablets in many window sizes, including split screen. Pages need a way to respond to a wider window and to a resting pointer without leaving the utility system. The glossary's example prefix was wide.

Decision

  • **hover:** applies while a pointer rests on the element. It is web only, and on the web it is wrapped in @media (hover: hover) so a tap on a phone browser never leaves it stuck. On iOS and Android it never applies; pressed: is the cross-target feedback.
  • **md: applies from a window width of 768px and lg:** from 1024px, written mobile first: the unprefixed utility is the phone layout. On the web they become min-width media queries; the widths are data on the prefix in spec/styling/utilities.yaml. On native they will map to window size classes: md to a regular-width window on iOS and a medium (600dp and up) width class on Android, lg to an expanded (840dp and up) width class, or the closest the platform reports.
  • Prefixes carry a kind (state, scheme, window). Rules for one element are ordered by Utilities::cascade_key, never by class order: first the strongest state (disabled: 4, pressed: 3, focus: 2, hover: 1, data on the prefix), then the widest window (lg: over md:), then the number of conditions. Every target uses the same key.

Alternatives considered

OptionWhy not
A single wide: prefixOne step cannot tell a tablet in portrait from a laptop; two steps cover phone, tablet and desktop
Tailwind's five steps (sm to 2xl)More than an app needs, and native size classes have only two or three steps
Android's breakpoints (600dp, 840dp) on the web tooWeb conventions and existing CSS habits are 768px and 1024px; native maps to its own classes anyway
hover: on native as a long press or pointer hoveriPad and Android pointers exist but are rare; a style that only some devices see invites bugs

Consequences

The glossary example (wide) and docs/explanation/domain.md should say md once this is accepted. The native emitter needs the window size class in its condition evaluation.