Good Code
The good version uses one arbitrary grid template because the layout needs a flexible text column plus an auto shortcut column.
Lesson 08
Use arbitrary values for specific layout constraints, not as a replacement for the shared design scale.
export function CommandRow({ label, shortcut }: CommandRowProps) {
return (
<div className="grid grid-cols-[minmax(0,1fr)_auto] items-center gap-3 rounded-md px-3 py-2 text-sm hover:bg-slate-100">
<span className="truncate text-slate-800">{label}</span>
<kbd className="rounded border border-slate-200 bg-white px-1.5 py-0.5 text-xs text-slate-500">
{shortcut}
</kbd>
</div>
);
}export function CommandRow({ label, shortcut }) {
return (
<div className="grid grid-cols-[417px_68px] items-center gap-[11px] rounded-[7px] px-[13px] py-[9px] text-[13.5px] hover:bg-[#f1f5f9]">
<span className="max-w-[391px] truncate text-[#1f2937]">{label}</span>
<kbd className="rounded-[3px] border border-[#e2e8f0] bg-[#ffffff] px-[5px] py-[2px] text-[11px] text-[#64748b]">
{shortcut}
</kbd>
</div>
);
}The good version uses one arbitrary grid template because the layout needs a flexible text column plus an auto shortcut column.
The bad version uses arbitrary values for nearly every decision. That makes the component hard to align with the rest of the UI.