@molecule/app-feature-transport-bar-svelte
Feature · feature-transport-bar · App (browser) · v1.1.4 · 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-svelteHow it works
@molecule/app-feature-transport-bar-svelte 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.
<script lang="ts">
import { TransportBar } from '@molecule/app-feature-transport-bar-svelte'
let playing = $state(false)
let recording = $state(false)
let loop = $state(false)
</script>
<TransportBar
isPlaying={playing}
isRecording={recording}
{loop}
onPlayToggle={() => (playing = !playing)}
onStop={() => (playing = false)}
onRecordToggle={() => (recording = !recording)}
onLoopToggle={() => (loop = !loop)}
timeDisplay="0:42 / 3:10"
/>Works with: @molecule/app-svelte, @molecule/app-ui, @molecule/app-ui-svelte
Reference
Svelte 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 Svelte
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
<script lang="ts">
import { TransportBar } from '@molecule/app-feature-transport-bar-svelte'
let playing = $state(false)
let recording = $state(false)
let loop = $state(false)
</script>
<TransportBar
isPlaying={playing}
isRecording={recording}
{loop}
onPlayToggle={() => (playing = !playing)}
onStop={() => (playing = false)}
onRecordToggle={() => (recording = !recording)}
onLoopToggle={() => (loop = !loop)}
timeDisplay="0:42 / 3:10"
/>
Type
feature
Installation
npm install @molecule/app-feature-transport-bar-svelte @molecule/app-svelte @molecule/app-ui @molecule/app-ui-svelte svelte
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: (event: Event) => void
/** Stop playback (resets to start). Required. */
onStop: (event: Event) => void
/** Skip to the previous marker / start of clip. Optional. */
onSkipBack?: (event: Event) => void
/** Skip to the next marker / end of clip. Optional. */
onSkipForward?: (event: Event) => void
/** Toggle record mode. Optional — when omitted no record button is rendered. */
onRecordToggle?: (event: Event) => void
/** Toggle loop mode. Optional — when omitted no loop button is rendered. */
onLoopToggle?: (event: Event) => void
/**
* Optional time-display slot rendered alongside the controls (typical
* use: `current / total` time). Takes precedence over `children`. A
* snippet (as a node prop) or plain text.
*/
timeDisplay?: Snippet | string | number | boolean | null
/**
* Optional time-display slot. Equivalent to `timeDisplay` — provided
* for ergonomic markup nesting. Ignored when `timeDisplay` is set.
*/
children?: Snippet | string | number | boolean | null
/** Extra classes merged onto the root element. */
className?: string
}
Constants
TransportBar
const TransportBar: LegacyComponentType
Injection Notes
Requirements
Peer dependencies:
@molecule/app-svelte^3.13.0 || ^4.0.0@molecule/app-ui^1.0.1@molecule/app-ui-svelte^1.6.0svelte^5.0.0
Runtime Dependencies
-
@molecule/app-svelte -
@molecule/app-ui -
@molecule/app-ui-svelte -
svelte -
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; it takes precedence over the default content (children), which fills the same slot whentimeDisplayis omitted.
Translations
Translation strings are provided by @molecule/app-locales-feature-transport-bar.