Skip to content

feat: space, columns, rows and box grid item deprecation warnings#2182

Open
pedrobonamin wants to merge 9 commits intomainfrom
props-deprecation-warnings
Open

feat: space, columns, rows and box grid item deprecation warnings#2182
pedrobonamin wants to merge 9 commits intomainfrom
props-deprecation-warnings

Conversation

@pedrobonamin
Copy link
Copy Markdown
Collaborator

@pedrobonamin pedrobonamin commented Mar 16, 2026

Description

  • Migrated spacing APIs across primitives/components to support gap while keeping space backward compatible, with clear v4 deprecation for space.
  • Added migration for Grid template props: gridTemplateColumns/gridTemplateRows now preferred over deprecated columns/rows (with precedence to new props).
Prop Count in monorepo
space 414 results
columns 27 results
rows 1

This will help us have a smaller footprint one we are ready to migrate sanity monorepo to ui v4 or v5, most of the changes in the migration PR are related to this props renames. If we do that before the migration it will help us reduce the noise in the migration PR.
It will also help prepare users for the migration, by doing this change they can start updating the props for when we finally migrate the studio.

What Changed

Spacing migration (space -> gap, with backward compatibility)

Updated these APIs to accept both props and prefer gap:

  • Primitives: Inline, Stack, Button, TextInput, Select
  • Components: TabList (via InlineProps), Menu, MenuItem, MenuGroup, Hotkeys, Breadcrumbs, Tree, TreeItem
  • Tree context contract: added gap while retaining deprecated space

All affected space props are now documented as deprecated (v4 removal).

Grid migration (columns/rows -> gridTemplateColumns/gridTemplateRows)

  • Added new preferred props:
    • gridTemplateColumns
    • gridTemplateRows
  • Kept deprecated aliases:
    • columns
    • rows
  • Implemented precedence:
    • gridTemplateColumns ?? columns
    • gridTemplateRows ?? rows
  • Updated Grid story defaults/examples and added focused tests.

Deprecates box grid item props column for gridColumn and equivalents.

export interface ResponsiveGridItemProps {
  gridColumn?: GridItemColumn | GridItemColumn[]
  /**
   * @deprecated Use `gridColumn` instead. `column` will be removed in v4.
   */
  column?: GridItemColumn | GridItemColumn[]
  gridColumnStart?: GridItemColumnStart | GridItemColumnStart[]
  /**
   * @deprecated Use `gridColumnStart` instead. `columnStart` will be removed in v4.
   */
  columnStart?: GridItemColumnStart | GridItemColumnStart[]
  gridColumnEnd?: GridItemColumnEnd | GridItemColumnEnd[]
  /**
   * @deprecated Use `gridColumnEnd` instead. `columnEnd` will be removed in v4.
   */
  columnEnd?: GridItemColumnEnd | GridItemColumnEnd[]
  gridRow?: GridItemRow | GridItemRow[]
  /**
   * @deprecated Use `gridRow` instead. `row` will be removed in v4.
   */
  row?: GridItemRow | GridItemRow[]
  gridRowStart?: GridItemRowStart | GridItemRowStart[]
  /**
   * @deprecated Use `gridRowStart` instead. `rowStart` will be removed in v4.
   */
  rowStart?: GridItemRowStart | GridItemRowStart[]
  gridRowEnd?: GridItemRowEnd | GridItemRowEnd[]
  /**
   * @deprecated Use `gridRowEnd` instead. `rowEnd` will be removed in v4.
   */
  rowEnd?: GridItemRowEnd | GridItemRowEnd[]
}

Test strategy

  • Added/updated focused migration tests to assert:
    1. legacy prop still works
    2. new prop works
    3. new prop takes precedence when both are provided

What to review

Is the deprecation warning ok?

Testing

@pedrobonamin pedrobonamin requested a review from Copilot March 16, 2026 14:26
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 16, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
sanity-ui-storybook Ready Ready Preview, Comment Mar 30, 2026 2:21pm
sanity-ui-workshop Ready Ready Preview, Comment Mar 30, 2026 2:21pm

Request Review

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces backwards-compatible prop migrations across multiple UI primitives/components by adding new preferred props (gap, gridTemplateColumns, gridTemplateRows) while marking legacy aliases (space, columns, rows) as deprecated for removal in v4, and updates stories/tests to cover the migration behavior.

Changes:

  • Add gap to multiple primitives/components while keeping deprecated space working, and prefer gap when both are provided.
  • Add gridTemplateColumns/gridTemplateRows to Grid while keeping deprecated columns/rows, with precedence to the new props.
  • Update Storybook argTypes and add focused Jest tests asserting legacy support + new-prop precedence.

Reviewed changes

Copilot reviewed 42 out of 42 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
stories/primitives/TextInput.stories.tsx Exposes gap control alongside deprecated space.
stories/primitives/Stack.stories.tsx Adds gap control alongside deprecated space.
stories/primitives/Select.stories.tsx Adds gap control alongside deprecated space.
stories/primitives/Inline.stories.tsx Adds gap control alongside deprecated space.
stories/primitives/Grid.stories.tsx Adds controls for new/deprecated Grid template props.
stories/primitives/Button.stories.tsx Adds gap control and includes it in controls list.
stories/components/Tree.stories.tsx Adds gap control alongside deprecated space.
stories/components/TabList.stories.tsx Adds gap control alongside deprecated space.
stories/components/MenuItem.stories.tsx Adds gap control alongside deprecated space.
stories/components/Menu.stories.tsx Adds gap control alongside deprecated space.
stories/components/Hotkeys.stories.tsx Adds gap/space controls for spacing migration.
stories/components/Breadcrumbs.stories.tsx Adds gap control alongside deprecated space.
src/core/primitives/types.ts Deprecates columns/rows and adds gridTemplateColumns/gridTemplateRows to grid prop types.
src/core/primitives/textInput/textInput.tsx Adds gap, deprecates space, and prefers gap when provided.
src/core/primitives/textInput/textInput.test.tsx Tests space/gap equivalence and gap precedence.
src/core/primitives/stack/stack.tsx Adds gap, deprecates space, and prefers gap.
src/core/primitives/stack/stack.test.tsx Tests space/gap equivalence and gap precedence.
src/core/primitives/select/select.tsx Adds gap, deprecates space, and prefers gap.
src/core/primitives/select/select.test.tsx Tests space/gap equivalence and gap precedence.
src/core/primitives/inline/inline.tsx Adds gap, deprecates space, and prefers gap.
src/core/primitives/inline/inline.test.tsx Tests space/gap equivalence and gap precedence.
src/core/primitives/grid/grid.tsx Adds new Grid template props with precedence over deprecated aliases.
src/core/primitives/grid/grid.test.tsx Tests old/new Grid template props + precedence behavior.
src/core/primitives/button/button.tsx Adds gap, deprecates space, and prefers gap for icon/text spacing.
src/core/primitives/button/button.test.tsx Tests space/gap behavior and gap precedence.
src/core/components/tree/types.ts Extends Tree context contract to include gap while deprecating space.
src/core/components/tree/treeItem.tsx Adds gap, deprecates space, and prefers gap for item spacing.
src/core/components/tree/treeItem.test.tsx Tests space/gap behavior and gap precedence for TreeItem.
src/core/components/tree/treeGroup.tsx Switches TreeGroup layout to use context gap.
src/core/components/tree/tree.tsx Adds gap, deprecates space, and forwards gap while keeping context compatibility.
src/core/components/tree/tree.test.tsx Tests Tree space/gap behavior and gap precedence.
src/core/components/tab/tabList.test.tsx Tests gap/space support via Inline styling hook.
src/core/components/menu/menuItem.tsx Adds gap, deprecates space, and prefers gap for item layout.
src/core/components/menu/menuItem.spacing.test.tsx Tests MenuItem space/gap behavior and gap precedence.
src/core/components/menu/menuGroup.tsx Adds gap, deprecates space, and prefers gap for group layout.
src/core/components/menu/menuGroup.spacing.test.tsx Tests MenuGroup space/gap behavior and gap precedence.
src/core/components/menu/menu.tsx Adds gap, deprecates space, and prefers gap when rendering Stack.
src/core/components/menu/menu.spacing.test.tsx Tests Menu space/gap behavior and gap precedence.
src/core/components/hotkeys/hotkeys.tsx Adds gap, deprecates space, and prefers gap when rendering Inline.
src/core/components/hotkeys/hotkeys.test.tsx Tests Hotkeys space/gap behavior and gap precedence.
src/core/components/breadcrumbs/breadcrumbs.tsx Adds gap, deprecates space, and uses gap when rendering stacked overflow list.
src/core/components/breadcrumbs/breadcrumbs.test.tsx Tests Breadcrumbs space/gap behavior and gap precedence.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a backwards-compatible spacing migration across primitives/components (space → preferred gap) and updates Grid to prefer gridTemplateColumns/gridTemplateRows over deprecated columns/rows, with Storybook updates and focused migration tests.

Changes:

  • Add gap props (preferred) while keeping deprecated space across multiple primitives/components, plus corresponding Storybook controls.
  • Add gridTemplateColumns/gridTemplateRows to Grid (preferred) while retaining deprecated columns/rows with precedence to the new props.
  • Add focused Jest tests to validate legacy support + new prop precedence.

Reviewed changes

Copilot reviewed 42 out of 42 changed files in this pull request and generated 14 comments.

Show a summary per file
File Description
stories/primitives/TextInput.stories.tsx Adds gap control alongside existing space.
stories/primitives/Stack.stories.tsx Adds gap control alongside existing space.
stories/primitives/Select.stories.tsx Adds gap control alongside existing space.
stories/primitives/Inline.stories.tsx Adds gap control alongside existing space.
stories/primitives/Grid.stories.tsx Adds controls for deprecated columns/rows and preferred gridTemplateColumns/gridTemplateRows.
stories/primitives/Button.stories.tsx Adds gap control and includes gap in the WithIcons control include list.
stories/components/Tree.stories.tsx Adds gap control alongside existing space.
stories/components/TabList.stories.tsx Adds gap control alongside existing space.
stories/components/MenuItem.stories.tsx Adds gap control alongside existing space.
stories/components/Menu.stories.tsx Adds gap control alongside existing space.
stories/components/Hotkeys.stories.tsx Adds gap/space argTypes and imports getSpaceControls.
stories/components/Breadcrumbs.stories.tsx Adds gap control alongside existing space.
src/core/primitives/types.ts Deprecates columns/rows and adds preferred gridTemplateColumns/gridTemplateRows to ResponsiveGridProps.
src/core/primitives/textInput/textInput.tsx Adds gap prop, deprecates space, and prefers gap when both are provided.
src/core/primitives/textInput/textInput.test.tsx Adds migration tests for space/gap behavior and precedence.
src/core/primitives/stack/stack.tsx Adds gap prop, deprecates space, and prefers gap.
src/core/primitives/stack/stack.test.tsx Adds migration tests for space/gap behavior and precedence.
src/core/primitives/select/select.tsx Adds gap prop, deprecates space, and prefers gap.
src/core/primitives/select/select.test.tsx Adds migration tests for space/gap behavior and precedence.
src/core/primitives/inline/inline.tsx Adds gap prop, deprecates space, and prefers gap.
src/core/primitives/inline/inline.test.tsx Adds migration tests for space/gap behavior and precedence.
src/core/primitives/grid/grid.tsx Adds preferred gridTemplateColumns/gridTemplateRows with precedence over deprecated columns/rows.
src/core/primitives/grid/grid.test.tsx Adds tests validating legacy aliases + new prop precedence.
src/core/primitives/button/button.tsx Adds gap prop, deprecates space, and maps to Flex gap with precedence to gap.
src/core/primitives/button/button.test.tsx Adds tests for space support, gap support, and precedence.
src/core/components/tree/types.ts Extends Tree context contract with gap while keeping deprecated space.
src/core/components/tree/treeItem.tsx Adds gap prop, deprecates space, and prefers gap for icon spacing.
src/core/components/tree/treeItem.test.tsx Adds tests validating space/gap behavior and precedence for TreeItem spacing.
src/core/components/tree/treeGroup.tsx Switches TreeGroup spacing usage to tree.gap.
src/core/components/tree/tree.tsx Adds gap prop, deprecates space, updates context + Stack usage to prefer gap.
src/core/components/tree/tree.test.tsx Adds tests validating Tree space/gap behavior and precedence.
src/core/components/tab/tabList.test.tsx Adds tests validating TabList space/gap behavior and precedence.
src/core/components/menu/menuItem.tsx Adds gap prop, deprecates space, and prefers gap for internal Flex gap.
src/core/components/menu/menuItem.spacing.test.tsx Adds tests validating MenuItem space/gap behavior and precedence.
src/core/components/menu/menuGroup.tsx Adds gap prop, deprecates space, and prefers gap for internal Flex gap.
src/core/components/menu/menuGroup.spacing.test.tsx Adds tests validating MenuGroup space/gap behavior and precedence.
src/core/components/menu/menu.tsx Adds gap prop, deprecates space, and prefers gap when rendering internal Stack.
src/core/components/menu/menu.spacing.test.tsx Adds tests validating Menu space/gap behavior and precedence.
src/core/components/hotkeys/hotkeys.tsx Adds gap prop, deprecates space, and prefers gap when passing spacing to Inline.
src/core/components/hotkeys/hotkeys.test.tsx Adds tests validating Hotkeys space/gap behavior and precedence.
src/core/components/breadcrumbs/breadcrumbs.tsx Adds gap prop, deprecates space, and prefers gap when spacing the overflow menu list.
src/core/components/breadcrumbs/breadcrumbs.test.tsx Adds tests validating Breadcrumbs space/gap behavior and precedence.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@pedrobonamin
Copy link
Copy Markdown
Collaborator Author

@copilot open a new pull request to apply changes based on the comments in this thread

Copy link
Copy Markdown

Copilot AI commented Mar 16, 2026

@pedrobonamin I've opened a new pull request, #2183, to work on those changes. Once the pull request is ready, I'll request review from you.

@pedrobonamin pedrobonamin changed the title Props deprecation warnings feat: space, columns, rows deprecation warnings Mar 17, 2026
* fix: reset mocks between renders in spacing migration tests

Co-authored-by: pedrobonamin <46196328+pedrobonamin@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: pedrobonamin <46196328+pedrobonamin@users.noreply.github.com>
stipsan
stipsan previously approved these changes Mar 27, 2026
Copy link
Copy Markdown
Member

@stipsan stipsan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this! It'll help the migration to v4 for sure 💖

import {Box} from '../../primitives'
import {Breadcrumbs} from './breadcrumbs'

jest.mock('../../primitives', () => {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh my goodness, I forgot this repo still uses jest 😧

@pedrobonamin pedrobonamin changed the title feat: space, columns, rows deprecation warnings feat: space, columns, rows and box grid item deprecation warnings Mar 30, 2026
@pedrobonamin pedrobonamin requested a review from stipsan March 30, 2026 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants