Skip to content

feat!: rename v11 labels, assistiveText and onRender* slot props - #3257

Merged
interactivellama merged 5 commits into
masterfrom
feat/v11-labels-naming
Oct 29, 2026
Merged

interactivellama merged 5 commits into
masterfrom
feat/v11-labels-naming

Conversation

@Niznikr

@Niznikr Niznikr commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

Additional description

Renames props that break the v11 naming rules. Every old name keeps working: it logs a one-time warning through check-props.js and is ignored when the new name is passed. Nothing here is breaking, and the story HTML snapshots are unchanged, so rendered markup is the same.

Naming (now in docs/codebase-overview.md → Callback Details)

on* names are for events only. onRender* reads as "a callback that runs after render", which these props were not. Content props now follow shadcn/Radix for slots and React Aria/Base UI for render props.

Every public content prop is one of three kinds. All 18 remaining onRender* props are marked @deprecated and point to their replacement.

Kind When Type Examples
Slot Content the component only renders ReactNode actions, content, figure, visualPickerFigure*
Render prop Content that depends on the component's data or state render<Part>: (data) => ReactNode renderItem, renderMenuItem, renderSubHeadingRow, renderListItem
Element prop An element the component clones or reads props from ReactElement<XProps> Combobox input/popover, DatePicker input, File icon, Input fieldLevelHelpTooltip, PageHeader and ScopedNotification icon

A render prop takes one data object with is* names for state, and the component calls it rather than mounting it as a component. Each data type is named <Component>Render<Part>Data and exported with that component's other types. The component keeps the element that carries roles, ARIA, focus and key, and the render prop returns what goes inside it. Table rows are the one exception: renderSubHeadingRow returns the <tr>.

ReactElement vs ReactNode

Every render prop already returned ReactNode. Eight props that are only rendered were still typed ReactElement, so they are now ReactNode:

  • Slots: SplitView master/detail, PageHeader trail, TabsPanel label, and SetupAssistantStep figure. SetupAssistantStep still shrinks an Icon figure to small; it now checks the figure is an element first.
  • Deprecated props' return types: Carousel onRenderItem, SetupAssistantStep onRenderFigure and MenuDropdown listItemRenderer.

This only widens what the types accept, so existing consumer code still type-checks. The element props in the table stay ReactElement: the component clones them or reads their props, so a string or fragment wouldn't work.

Labels and assistiveText

Component Old New
SplitView assistiveText.toggleButtonOpen / toggleButtonClose (inverted) assistiveText.closeToggle / openToggle
Tree heading, assistiveText.label labels.heading, assistiveText.heading
TrialBar labels.timeLeftUnit, labels.timeLeftUnitAfter labels.timeLeftAfter
Slider, Textarea label, errorText labels.label, labels.error + hasError

Zero-argument onRender* → slots

Component Old New
PageHeader onRenderActions, onRenderControls actions, controls
BuilderHeaderToolbar, TrialBar onRenderActions actions
WelcomeMat onRenderInfoActions infoActions
WelcomeMatInfoBadge onCompleteRenderActions completeActions
SetupAssistantStep onRenderAction, onRenderContent, onRenderFigure action, content, figure
ProgressIndicator steps[].onRenderSetupAssistantAction steps[].setupAssistantAction
Checkbox, Radio onRenderVisualPicker* visualPickerFigure*

Data render props → render<Part>(data)

Component Old New
Carousel onRenderItem renderItem({ item })
Combobox onRenderMenuItem, menuItem (component) renderMenuItem({ assistiveText, isSelected, option }), where selected becomes isSelected
SimpleDataTable onRenderSubHeadingRow renderSubHeadingRow(data), same data without key; the table sets the row key
MenuDropdown listItemRenderer (component) renderMenuItem({ icon, isSelected, option, optionIndex })
SplitViewListbox listItem (component) renderListItem({ isFocused, isSelected, isUnread, item })

Consumers who passed a component write renderMenuItem={(data) => <MyItem {...data} />}.

Commits

  1. style: formatting of the touched files only (prettier line wrapping and blank lines, 21 files). Review this one separately or skip it.
  2. feat: labels, assistiveText and slot renames
  3. docs: convention write-up, ROADMAP theme 7 progress, PR template example
  4. feat: data render props → render<Part>(data)
  5. fix(types): ReactNode widening

Examples and stories use the new names. CHANGELOG Unreleased lists every rename under Deprecated, and the widening under Changed.

Tests

52 new tests. Each rename is covered three ways: the new prop works, the old prop still works and warns, and the new prop wins when both are passed. Render props also check the exact data object. The full suite passes: 56 files, 1220 tests.

Still open (theme 7)

  • The Tree heading XOR as a union type (theme 8)
  • errorText on Input, Checkbox and Combobox

CONTRIBUTOR checklist (do not remove)

Please complete for every pull request.

Green gate — all of these must pass locally (CI runs the same):

  • npm run lint passes with 0 errors (npm run lint:fix to auto-fix). Warnings are the tracked gradual-migration backlog; do not add new errors.
  • npm run typecheck is clean (tsc --noEmit).
  • npm test -- --run passes — this runs both Vitest projects (jsdom unit + real-browser browser) and the story HTML snapshots. If you changed rendered markup on purpose, update snapshots with npm test -- --run -u and review the diff.
  • npm run build succeeds (type-check + Vite library build + .d.ts + entry shims).

Behavior & docs:

  • First-time contributors: sign the CLA (a bot will comment with instructions).
  • Added/updated Vitest + React Testing Library tests for the change (template: components/button/__tests__). New props and bug fixes should get a regression test. Tests that genuinely need a real browser (focus traversal, layout/measurement, canvas) go in a *.browser.test.jsx file (the browser project); everything else is jsdom.
  • Reviewed the component's Storybook stories: npm run storybook → http://localhost:6007/. Confirm the story actually renders and behaves (deprecated Storyshots/Karma are gone; there is no separate browser-tests server).
  • Story/example code uses the component's real prop API (e.g. slots like content / visualPickerFigure, render props like renderItem, icon props, events), not assumptions — a common source of "component looks broken" reports has been stories authored against the wrong API. Cross-check against components/<name>/__examples__.
  • Storybook Accessibility (a11y) panel shows no new violations for the affected stories.
  • If you added or changed a type, remember runtime PropTypes were removed in the TS migration — types are the contract. Ship accurate .d.ts (they're generated by the build); JS consumers rely on them via editor type-acquisition.

REVIEWER checklist (do not remove)

  • CI is green (GitHub Actions CI workflow: lint, typecheck, test, build). Chromatic visual review, if configured, has been checked.
  • Change has adequate test coverage; bug fixes include a regression test.
  • Reviewed the affected Storybook stories and their a11y panels.
  • Rendered markup still conforms to SLDS — check the story HTML snapshot diff (components/__tests__/__snapshots__/story-snapshots.test.jsx.snap).
  • Public API / package surface: if exports changed, the deep-import contract still holds (@salesforce/design-system-react/components/<name> and nested paths resolve for ESM, CJS, and types). Removing/renaming a public component or export is a breaking change → feat!:/BREAKING CHANGE: and a major version bump.

@Niznikr
Niznikr force-pushed the feat/v11-labels-naming branch from 98901a7 to b754f30 Compare October 28, 2026 20:07
@interactivellama

Copy link
Copy Markdown
Contributor

I love the element, render and slot categories. Well thought out!

Niznikr and others added 5 commits October 29, 2026 17:04
Theme 7 of the v11 prop API freeze review. Old names keep working and
emit a dev-only deprecation warning through each component's check-props.

- split-view: assistiveText.toggleButtonOpen/toggleButtonClose (inverted)
  -> closeToggle/openToggle
- tree: heading and assistiveText.label -> labels.heading and
  assistiveText.heading
- trial-bar: labels.timeLeftUnit + timeLeftUnitAfter -> a single
  labels.timeLeftAfter; onRenderActions -> actions
- slider, textarea: label -> labels.label; errorText -> labels.error +
  hasError
- zero-argument onRender* thunks -> ReactNode slots: page-header
  actions/controls, builder-header toolbar actions, welcome-mat
  infoActions, info-badge completeActions, setup-assistant step
  action/content/figure, progress-indicator steps[].setupAssistantAction,
  checkbox/radio visualPickerFigure*

Also wires the previously unused check-props for textarea and
page-header, and exposes the setup-assistant step fields on the public
ProgressStep type.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Render props that take data keep the onRender prefix; zero-argument
content is a named ReactNode slot.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`on*` names are now reserved for events. Render props that take data
follow React Aria and Base UI: `render<Part>: (data) => ReactNode`,
called with one data object (`is*` state names) rather than mounted as
a component. Static content stays a `ReactNode` slot (shadcn/Radix).

- Carousel `onRenderItem` -> `renderItem({ item })`
- Combobox `onRenderMenuItem` / `menuItem` (components) ->
  `renderMenuItem({ assistiveText, isSelected, option })`
- SimpleDataTable `onRenderSubHeadingRow` -> `renderSubHeadingRow`
  (no `key`; the table keys the row)
- MenuDropdown `listItemRenderer` (component) ->
  `renderMenuItem({ icon, isSelected, option, optionIndex })`
- SplitViewListbox `listItem` (component) ->
  `renderListItem({ isFocused, isSelected, isUnread, item })`

The old props keep working, warn once through check-props, and are
ignored when the new prop is passed. Examples and stories use the new
props. Updates the Props Conventions doc, PR template, ROADMAP and
CHANGELOG (including the theme 7 slot renames from the previous commit).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Content that a component only renders is now `ReactNode`, matching the
slots and render props: SplitView `master`/`detail`, PageHeader
`trail`, TabsPanel `label`, SetupAssistantStep `figure`, and the
return types of the deprecated Carousel `onRenderItem`,
SetupAssistantStep `onRenderFigure` and MenuDropdown
`listItemRenderer`. SetupAssistantStep checks `isValidElement` before
resizing an `Icon` figure.

`ReactElement` stays on element props, which the component clones or
reads props from (Combobox `input`/`popover`, File `icon`, etc.). The
Props Conventions doc now names that third category.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@interactivellama
interactivellama merged commit 855186e into master Oct 29, 2026
10 checks passed
@interactivellama
interactivellama deleted the feat/v11-labels-naming branch October 29, 2026 22:18
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.

2 participants