Components/VersionCapsule

VersionCapsule

A split release pill: download on the left, history on the right.

VerifiedSince 0.3.9

Usage

Download and History

The download and history slots hold the two panels; their close slot prop closes the panel and returns focus.

Loading demo...

Channel Tones

tone sets the status dot and channel color.

Loading demo...

Best Practices

  • Always name the channel (BETA, STABLE, NIGHTLY), never "LATEST"; pair the capsule with the page's stable download button instead of replacing it.
  • Put pre-release caveats in the download panel's notice (warning); use success for certified builds.
  • Give builds an href so they download directly as <a download>; omit it only when the URL is resolved on select.
  • Mark only the visitor's platform build recommended.
  • Match each history entry's tone to its channel, and use note only on latest.

API Reference

TxVersionCapsule

Props

PropTypeDefaultDescription
versionstring— (required)Version tag shown as the headline, e.g. v2.4.13-beta.19.
channelstring-Channel label beside the status dot, e.g. BETA; hidden when unset.
toneTxVersionChannelTone'preview'Color of the dot and channel label.
historyLabelstring'History'Text of the right segment.
downloadLabelstring'Download this build'Accessible name of the left segment.
panelTxVersionCapsulePanel-Controlled open panel, for v-model:panel; omit for uncontrolled.
disabledbooleanfalseDisables both segments and closes any open panel.
closeOnClickOutsidebooleantrueCloses the panel on an outside pointerdown.
closeOnEscbooleantrueCloses the panel on Escape.

Events

EventParamsDescription
update:panel(value: TxVersionCapsulePanel)Fires when the open panel changes.
download-Fires when the left segment is activated.
history-Fires when the right segment is activated.

Slots

SlotPropsDescription
download{ close: () => void }Download panel content, anchored under the left segment.
history{ close: () => void }History panel content, anchored under the right segment.

Exposed Methods

MemberTypeDescription
close() => voidCloses the panel and returns focus to its segment; also passed to both slots.
downloadRefRef<HTMLButtonElement | null>The left segment's button element.
historyRefRef<HTMLButtonElement | null>The right segment's button element.

TxVersionDownloadPanel

Props

PropTypeDefaultDescription
noticeTxVersionNotice-Trust block above the builds; omit to show builds only.
buildsTxVersionBuild[][]Builds per platform.
buildsLabelstring'Choose a build'Overline above the build list.
downloadLabelstring'Download'Text on the recommended build's button.
emptyTextstring'No builds published yet.'Shown when builds is empty.

Events

EventParamsDescription
select(id: string)Fires with the build's id when a build is chosen.

Slots

SlotPropsDescription
footer-Footer below the build list.

TxVersionHistoryPanel

Props

PropTypeDefaultDescription
titlestring'Version history'Panel heading.
latestTxVersionHistoryEntry-Featured card above the list.
entriesTxVersionHistoryEntry[][]Release rows below the featured card.
latestLabelstring'LATEST'Badge on the featured card.
countLabelstring-Right side of the header, e.g. 6 releases.
notesLabelstring"What's new"Call to action on the featured card.
emptyTextstring'No releases published yet.'Shown when there is neither latest nor any entries.

Events

EventParamsDescription
select(entry: TxVersionHistoryEntry)Fires when a release row or the featured card is chosen.

Slots

SlotPropsDescription
footer-Footer below the release list.

Types

TxVersionChannelTone is 'stable' \| 'preview' \| 'nightly' \| 'neutral', mapped to success / primary (default) / warning / secondary colors.

TxVersionBuild

FieldTypeDescription
idstringList key.
namestringHeadline, e.g. macOS · Apple silicon.
metastring?Secondary line, e.g. .dmg · 126 MB.
hrefstring?Direct URL; renders the row as <a download>, otherwise a <button>.
recommendedboolean?The visitor's platform build; only the first gets the highlight and labelled button.
iconstring?Icon class before the name; the consumer supplies the icon set.

TxVersionNotice

FieldTypeDescription
tone'warning' | 'success'warning (default) for pre-release caveats, success for certified builds.
titlestringNotice headline.
descriptionstring?Supporting sentence.
pointsstring[]?Bulleted caveats.

TxVersionHistoryEntry

FieldTypeDescription
idstringList key.
tagstringVersion tag.
channelstring?Channel label, e.g. BETA.
toneTxVersionChannelTone?Tone of this row; defaults to preview.
datestring?Release date text.
notestring?One-line changelog, rendered only on latest.
hrefstring?Renders the row or card as a link.

Overview

  • The two segments are independent click targets: the left downloads the build, the right opens history. Don't wrap the whole capsule in one action.
  • One panel is open at a time; clicking the other segment swaps panels, and clicking the active one closes it.
  • Panels anchor under their own segment (download left-aligned, history right-aligned) and are not modal.
  • panel left undefined means uncontrolled; null is the controlled "all closed" value.
  • Without a slot, its segment only emits its event and opens nothing — useful when the host has its own dialog.

Technologies

  • Source: packages/tuffex/packages/components/src/version-capsule/.
查看源码
packages/tuffex/packages/components/src/version-capsule/index.ts