Skip to content

feat(button): add xx-small icon size - #3228

Merged
interactivellama merged 2 commits into
masterfrom
feat/button-icon-xx-small
Oct 9, 2026
Merged

interactivellama merged 2 commits into
masterfrom
feat/button-icon-xx-small

Conversation

@Niznikr

@Niznikr Niznikr commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

Additional description

Adds xx-small to Button's iconSize so icon buttons can match lightning-button-icon, which supports xx-small for non-bare variants.

  • With iconVariant (container, border, border-filled, …): applies slds-button_icon-xx-small to the <button> (1rem button, 0.5rem glyph). This uses the same code path as the existing x-small and small container sizes.
  • Without iconVariant: the size is not forwarded to ButtonIcon. SLDS (2.25) defines no slds-button__icon_xx-small for the SVG, so passing it through would emit a class with no CSS. The iconSize JSDoc says xx-small requires iconVariant.

Changes:

  • ButtonIconSize type gains 'xx-small' (additive, not breaking).
  • New IconXXSmall story (border-filled close icon) and its HTML snapshot.
  • Unit test that the button container gets slds-button_icon-xx-small and the SVG gets no size class.

Commits are split per AGENTS.md: style(button) holds only the prettier reformatting that the pre-commit hook applied to the touched files, and feat(button) is the functional change.


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. render-props like onRenderContent / onRenderVisualPicker, 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 and others added 2 commits October 5, 2026 17:01
Add `xx-small` to `iconSize` to match `lightning-button-icon`. With an
`iconVariant`, it applies `slds-button_icon-xx-small` to the button
container. SLDS defines no `slds-button__icon_xx-small`, so without an
`iconVariant` the size is not forwarded to the SVG.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@interactivellama
interactivellama merged commit 15037af into master Oct 9, 2026
9 of 11 checks passed
@interactivellama
interactivellama deleted the feat/button-icon-xx-small branch October 9, 2026 22:19
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