Skip to content

Commit 3fe1c29

Browse files
myelinated-wackerowclaudewackerow
committed
patch(ui): drop unused Grid asChild prop
asChild was added to support a Grid-as-<ul> semantic-list pattern that ProductList no longer uses, and nothing else consumes it. Remove the prop, its Slot import, and the doc bullet; the cols=1 support from the same original change stays. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Co-Authored-By: wackerow <54227730+wackerow@users.noreply.github.com>
1 parent 5a54ce7 commit 3fe1c29

2 files changed

Lines changed: 3 additions & 7 deletions

File tree

.claude/skills/design-system/references/components.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ Responsive grid for laying out a collection of items (cards, tiles, badges). Ren
160160
- `size`: `small (7rem) | narrow (12rem) | base (18rem, default) | wide (22rem) | wider (26rem)`. The **min item width** (`--grid-item-min`) — the floor an item shrinks to before a column drops, and so the fold-aggressiveness lever. Pick by item shape: `small` for badges, `base` for standard content cards, `wide`/`wider` for horizontal items like callouts. Larger sizes wrap sooner; keep `columns` small enough that N items of the chosen width fit (min ≤ container/N).
161161
- `fit`: `boolean` (auto-fill mode only). Default keeps empty tracks (`auto-fill`); `fit` collapses them (`auto-fit`) so a partially-filled row stretches to fill the width.
162162
- `balanced`: `2 | 4`. A fixed, deterministic **breakpoint** reflow (overrides `columns` via `!important`; `size`/`fit` inert). `balanced={4}``4 → 2×2 → 1`, never an orphan 3-up row (which auto-fill produces); `balanced={2}``2 → 1` at `md`, a breakpoint-driven alternative to `columns={2}` (which folds by content width). Both fold `1 → 2` at `md`. Use with a **fixed set** of that many items (or a multiple).
163-
- `asChild`: contribute Grid's classes to the child element (Radix `Slot`) instead of rendering a `div` -- for when the grid must BE a semantic element, e.g. a `<ul>`.
164163
- Applies `gap-4`. `className` is spread last, so override the gap (or `--grid-item-min` / `--grid-repeat`) per call site only when genuinely needed. **If you override the gap, mirror it in `--grid-gap`** (e.g. `gap-x-8 [--grid-gap:--spacing(8)]`): the `grid-cols-auto-*` fold math assumes the gutter via `var(--grid-gap, 1rem)`, and with a wider real gap the even-share term is computed against the wrong gutter -- a second column may **never** form.
165164

166165
### `Section`

src/components/ui/grid.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import * as React from "react"
22
import { cva, VariantProps } from "class-variance-authority"
3-
import { Slot } from "@radix-ui/react-slot"
43

54
import { cn } from "@/lib/utils/cn"
65

@@ -61,12 +60,10 @@ const gridVariants = cva("grid gap-4", {
6160

6261
const Grid = React.forwardRef<
6362
HTMLDivElement,
64-
React.HTMLAttributes<HTMLDivElement> &
65-
VariantProps<typeof gridVariants> & { asChild?: boolean }
66-
>(({ className, columns, size, fit, balanced, asChild, ...props }, ref) => {
67-
const Comp = asChild ? Slot : "div"
63+
React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof gridVariants>
64+
>(({ className, columns, size, fit, balanced, ...props }, ref) => {
6865
return (
69-
<Comp
66+
<div
7067
ref={ref}
7168
data-label="grid"
7269
className={cn(gridVariants({ columns, size, fit, balanced }), className)}

0 commit comments

Comments
 (0)