concrete/style/no-px-breakpoint
An arbitrary `min-[…]:` or `max-[…]:` breakpoint is written in `rem`, never `px`.
An arbitrary min-[…]: or max-[…]: breakpoint is written in rem, never px.
Graded by the lint stage of concrete check, in the lint venue. A violation reports this id and the file it failed at — see every rule and concrete check.
Reason
Tailwind sorts min-width and max-width variants by the value's unit before its number,
and every built-in breakpoint is in rem. A px-valued arbitrary variant therefore sorts
into its own block, ahead of or behind the whole default ladder — never by which threshold
is actually closer. Wherever a viewport matches both your min-[1280px]: and a built-in
lg:, the built-in wins, and nothing reports it: the class list reads correctly and
the section is simply sized wrong.
Fix
Write the threshold in rem: divide the pixels by 16, so min-[1280px]: becomes
min-[80rem]:. Container-query variants (@min-[1024px]:) compile to @container and
share no cascade position with sm:/md:/lg:, so they carry none of this and are
exempt.
Before and after
import { Section, section, Slot, text } from "@homepages/concrete";
export const Hero = section(
{ key: "hero", label: "Hero", slots: { headline: text.medium({ label: "Headline" }) } },
({ slot }) => (
<Section className="grid gap-4 min-[1280px]:grid-cols-2">
<Slot.Text slot={slot.headline} as="h1" />
</Section>
),
);import { Section, section, Slot, text } from "@homepages/concrete";
export const Hero = section(
{ key: "hero", label: "Hero", slots: { headline: text.medium({ label: "Headline" }) } },
({ slot }) => (
<Section className="grid gap-4 min-[80rem]:grid-cols-2">
<Slot.Text slot={slot.headline} as="h1" />
</Section>
),
);