Version Bump

Suggests the semver bump a set of changes needs and warns when the pick is too small, so breaking changes don't ship as minor or patch.

StopsBreaking change shipped as a minor

Installation

pnpm dlx shadcn@latest add https://bollard-ui.vercel.app/r/version-bump.json

The files land in your project. They're yours to edit.

Usage

version-bump-usage.tsx
import { VersionBump } from "@/components/ui/version-bump"

<VersionBump
  current="1.4.2"
  defaultValue="minor"
  changes={["feat!: drop Node 16 support", "feat(cli): add --json output", "fix: retry uploads on 429", "docs: fix typo in README"]}
/>

What it catches

  • A minor or patch for breaking changes, which ^ranges would install
  • A major with no breaking changes
  • 0.x versions, where the minor slot carries breaking changes in npm ranges
  • Pre-release tags dropped on release and tags that sort backwards (beta < rc)
  • Invalid current versions

Props

VersionBump props
PropTypeDefault
current* (required)

The version being released from.

string—
changes* (required)

Changes since `current`: Conventional Commits subjects ("feat!: drop Node 16") or classified entries.

(string | Change)[]—
value

Controlled bump.

Bump—
defaultValue

Initial bump when uncontrolled. Defaults to the smallest one the changes need.

Bump—
onValueChange

Called when the bump changes.

(bump: Bump) => void—
onVersionChange

Called with the resulting version string whenever it changes.

(version: string) => void—
defaultPreid

Pre-release tag to use. Defaults to the current one, or "beta".

string—
messages

Override any string.

Partial<typeof VERSION_BUMP_MESSAGES>—

* required. Also accepts the native props of <div> (className, aria-*, data-*…), passed through to it.

Accessibility

  • Bump options are a roving-tabindex radiogroup with arrow keys
  • Needed bump marked with text, not colour alone
  • Readback and warnings in polite live regions; invalid input uses role=alert

Only what the source does. Test with your own screen reader and content before shipping.

Limitations

  • Only as good as the change list: commits without type or ! markers are missed
  • Semver says 0.y.z may change anything; the 0.x handling follows npm caret behaviour

Rules

Rules last verified:

Confirmed §11 pre-release precedence (1.0.0-alpha < … < 1.0.0-rc.1 < 1.0.0) and that 0.y.z is for initial development. Copied components don't update themselves, so re-check after rule changes (see updating a component).

What it stops

Breaking change shipped as a minor

Also known as

semver · version bump · release · changelog · conventional commits · npm publish · changesets · major minor patch

Field type

Dependencies

Pairs well with