@molecule/app-feature-transport-bar-vue
Feature · feature-transport-bar · App (browser) · v1.1.2 · Apache-2.0
Transport-control bar (play / pause / stop / record / skip / loop) used by music-daw + video-editor for editor playback control
npm install @molecule/app-feature-transport-bar-vueHow it works
@molecule/app-feature-transport-bar-vue is a ready-made feature-transport-bar feature for the app (browser) side. It composes the core interfaces it needs, so it works with whichever providers your app has bonded.
import { createApp, defineComponent, h, ref } from 'vue'
import { TransportBar } from '@molecule/app-feature-transport-bar-vue'
const Editor = defineComponent({
setup() {
const playing = ref(false)
const recording = ref(false)
const loop = ref(false)
return () =>
h(TransportBar, {
isPlaying: playing.value,
isRecording: recording.value,
loop: loop.value,
onPlayToggle: () => (playing.value = !playing.value),
onStop: () => (playing.value = false),
onRecordToggle: () => (recording.value = !recording.value),
onLoopToggle: () => (loop.value = !loop.value),
timeDisplay: '0:42 / 3:10',
})
},
})
createApp(Editor).mount('#app')Works with: @molecule/app-ui, @molecule/app-ui-vue, @molecule/app-vue
Reference
Vue transport bar — play / pause / stop / record / skip / loop controls for editor playback (music DAW, video editor, animation tool).
Exports <TransportBar>. All styling routes through getClassMap()
and all button labels translate via the companion
@molecule/app-locales-feature-transport-bar locale bond. It is the Vue
counterpart of @molecule/app-feature-transport-bar-react: the same props,
the same DOM for the same input, and the same callbacks.
Auto-generated, AI-first package reference for the molecule.dev ecosystem. It is written to be read by coding agents as much as by people, and is generated from this package's source — edit
src/index.tsJSDoc, not this file.
Quick Start
import { createApp, defineComponent, h, ref } from 'vue'
import { TransportBar } from '@molecule/app-feature-transport-bar-vue'
const Editor = defineComponent({
setup() {
const playing = ref(false)
const recording = ref(false)
const loop = ref(false)
return () =>
h(TransportBar, {
isPlaying: playing.value,
isRecording: recording.value,
loop: loop.value,
onPlayToggle: () => (playing.value = !playing.value),
onStop: () => (playing.value = false),
onRecordToggle: () => (recording.value = !recording.value),
onLoopToggle: () => (loop.value = !loop.value),
timeDisplay: '0:42 / 3:10',
})
},
})
createApp(Editor).mount('#app')
Type
feature
Installation
npm install @molecule/app-feature-transport-bar-vue @molecule/app-ui @molecule/app-ui-vue @molecule/app-vue vue
API
Interfaces
TransportBarProps
Transport-bar component props.
interface TransportBarProps {
/**
* Whether playback is currently running. Drives the play / pause toggle
* button's icon, label, and `aria-pressed` state.
*/
isPlaying: boolean
/**
* Whether recording is currently armed / running. Drives the record
* button's icon, label, and `aria-pressed` state. The record button
* itself renders only when `onRecordToggle` is provided.
*/
isRecording?: boolean
/**
* Whether the stop button is enabled. When `false`, the button still
* renders but is `disabled` (use this to communicate that there is
* nothing to stop). Defaults to `true` when omitted.
*/
canStop?: boolean
/**
* Whether the skip-back / skip-forward buttons are enabled. When
* `false`, the buttons still render but are `disabled`. Defaults to
* `true` when omitted. Skip buttons only render when their respective
* `onSkipBack` / `onSkipForward` handlers are provided.
*/
canSkip?: boolean
/**
* Whether loop playback is currently engaged. Drives the loop
* button's `aria-pressed` state. The loop button itself renders only
* when `onLoopToggle` is provided.
*/
loop?: boolean
/** Toggle play / pause. Required. */
onPlayToggle: () => void
/** Stop playback (resets to start). Required. */
onStop: () => void
/** Skip to the previous marker / start of clip. Optional. */
onSkipBack?: () => void
/** Skip to the next marker / end of clip. Optional. */
onSkipForward?: () => void
/** Toggle record mode. Optional — when omitted no record button is rendered. */
onRecordToggle?: () => void
/** Toggle loop mode. Optional — when omitted no loop button is rendered. */
onLoopToggle?: () => void
/**
* Optional time-display slot rendered alongside the controls (typical
* use: `current / total` time). Takes precedence over `children`. Passed
* as a prop or as the same-named slot — both work.
*/
timeDisplay?: VNodeChild
/**
* Optional time-display slot — the DEFAULT slot. Equivalent to
* `timeDisplay`; ignored when `timeDisplay` is set.
*/
children?: VNodeChild
/** Extra classes merged onto the root element. */
className?: string
}
Constants
TransportBar
Transport-control bar (play / pause / stop / record / skip / loop)
used by music-daw + video-editor surfaces for editor playback
control. Renders a horizontal bar of buttons with semantic icons and
fully translated aria-labels; an optional time-display slot lets
callers render the current playhead position / total duration without
coupling the bar to any specific time-format library.
Vue counterpart of @molecule/app-feature-transport-bar-react's
TransportBar — the same props (React names), the same DOM for the same
input, and the same callbacks. Node-valued props (timeDisplay) arrive as
a prop AND a same-named slot; children is the default slot.
const TransportBar: DefineComponent<
ExtractPropTypes<{
isPlaying: { type: PropType<boolean>; default: undefined }
isRecording: { type: PropType<boolean>; default: undefined }
canStop: { type: PropType<boolean>; default: boolean }
canSkip: { type: PropType<boolean>; default: boolean }
loop: { type: PropType<boolean>; default: undefined }
onPlayToggle: { type: PropType<TransportBarProps['onPlayToggle']>; default: undefined }
onStop: { type: PropType<TransportBarProps['onStop']>; default: undefined }
onSkipBack: { type: PropType<TransportBarProps['onSkipBack']>; default: undefined }
onSkipForward: { type: PropType<TransportBarProps['onSkipForward']>; default: undefined }
onRecordToggle: { type: PropType<TransportBarProps['onRecordToggle']>; default: undefined }
onLoopToggle: { type: PropType<TransportBarProps['onLoopToggle']>; default: undefined }
timeDisplay: { default: undefined }
className: { type: StringConstructor; default: undefined }
}>,
() => VNode,
{},
{},
{},
ComponentOptionsMixin,
ComponentOptionsMixin,
{},
string,
PublicProps,
Readonly<
ExtractPropTypes<{
isPlaying: { type: PropType<boolean>; default: undefined }
isRecording: { type: PropType<boolean>; default: undefined }
canStop: { type: PropType<boolean>; default: boolean }
canSkip: { type: PropType<boolean>; default: boolean }
loop: { type: PropType<boolean>; default: undefined }
onPlayToggle: { type: PropType<TransportBarProps['onPlayToggle']>; default: undefined }
onStop: { type: PropType<TransportBarProps['onStop']>; default: undefined }
onSkipBack: { type: PropType<TransportBarProps['onSkipBack']>; default: undefined }
onSkipForward: { type: PropType<TransportBarProps['onSkipForward']>; default: undefined }
onRecordToggle: { type: PropType<TransportBarProps['onRecordToggle']>; default: undefined }
onLoopToggle: { type: PropType<TransportBarProps['onLoopToggle']>; default: undefined }
timeDisplay: { default: undefined }
className: { type: StringConstructor; default: undefined }
}>
> &
Readonly<{}>,
{
onPlayToggle: () => void
onStop: () => void
onSkipBack: (() => void) | undefined
onSkipForward: (() => void) | undefined
onRecordToggle: (() => void) | undefined
onLoopToggle: (() => void) | undefined
isPlaying: boolean
isRecording: boolean
canStop: boolean
canSkip: boolean
loop: boolean
timeDisplay: undefined
className: string
},
{},
{},
{},
string,
ComponentProvideOptions,
true,
{},
any
>
props— Component props (seeTransportBarProps).
Returns: The transport-bar component.
Injection Notes
Requirements
Peer dependencies:
@molecule/app-ui^1.0.1@molecule/app-ui-vue^1.1.0@molecule/app-vue^3.13.0 || ^4.0.0vue^3.4.0
Runtime Dependencies
-
@molecule/app-ui -
@molecule/app-ui-vue -
@molecule/app-vue -
vue -
Requires a bonded ClassMap (
getClassMap()throws otherwise). -
All user-visible text (button labels) routes through
t()via the companion@molecule/app-locales-feature-transport-barlocale bond. -
timeDisplayis React's optional time-display slot: pass it as a prop or as the same-named slot. The default slot (children) is used whentimeDisplayis omitted, and is ignored when it is set.
Translations
Translation strings are provided by @molecule/app-locales-feature-transport-bar.