"use client";
import { VersionPicker } from "@pixxl-tools/components";| Prop | Type | Default | Description |
|---|---|---|---|
versions (required) | readonly VersionPickerVersion[] | — | Versions, newest first. |
getHref | (version: string) => string | — | Builds the URL of a version; navigates there on change. |
value | string | — | Current value (controlled); null where it means "nothing selected". |
defaultValue | string | — | Initial value when uncontrolled. |
label | string | "Version" | Accessible name (default "Version"). |
latest | string | the first | Latest version (default: the first). Gets a "latest" mark. |
onValueChange | (version: string) => void | — | Called with the new value (only when it changes). |
showLatestBadge | boolean | true | Show the "Latest" badge next to the select when it is selected. |
size | "md" | "sm" | — | Size from the shared scale (xs, sm, md, lg). |
variant | "field" | "ghost" | ghost | ghost (default): a borderless trigger with the pixxl chevron, like the other header controls (locale menu, theme switcher); still a native select, so it works with the keyboard and without JavaScript. field: the form select (a bordered field) for forms and toolbars. With a single version both render it as text, not a one-option select. |
versionsrequiredreadonly VersionPickerVersion[]
Versions, newest first.
getHref(version: string) => string
Builds the URL of a version; navigates there on change.
valuestring
Current value (controlled); null where it means "nothing selected".
defaultValuestring
Initial value when uncontrolled.
labeldefault "Version"string
Accessible name (default "Version").
latestdefault the firststring
Latest version (default: the first). Gets a "latest" mark.
onValueChange(version: string) => void
Called with the new value (only when it changes).
showLatestBadgedefault trueboolean
Show the "Latest" badge next to the select when it is selected.
size"md" | "sm"
Size from the shared scale (xs, sm, md, lg).
variantdefault ghost"field" | "ghost"
ghost (default): a borderless trigger with the pixxl chevron, like the other header controls (locale menu, theme switcher); still a native select, so it works with the keyboard and without JavaScript. field: the form select (a bordered field) for forms and toolbars. With a single version both render it as text, not a one-option select.
Other props are passed to the root element (HTMLAttributes<HTMLDivElement>), including className, style, id and aria-* attributes.
Complex object props use fixed fixtures. Primitive props stay editable.
<VersionPicker versions={versions} value="0.3" getHref={(version) => `/docs/${version}`} />const version = "5.2.0";
const versions = ["0.3", "0.2"];
<VersionPicker versions={["5.2.0", "5.1.0"]} value={version} getHref={(v) => `/documentation/${v}`} />const version = "5.2.0";
const versions = ["0.3", "0.2"];
<VersionPicker versions={versions} value="0.3" getHref={(version) => `/docs/${version}`} />