āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā š shadcn/directory/elevenlabs/ui/components/scrub-bar ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
<ComponentPreview name="scrub-bar-demo" description="An interactive timeline scrubber." />
npx @elevenlabs/cli@latest components add scrub-bar
</TabsContent>
<TabsContent value="manual">
<Steps>
<Step>Copy and paste the following code into your project.</Step>
<ComponentSource name="scrub-bar" title="components/ui/scrub-bar.tsx" /><Step>Update the import paths to match your project setup.</Step>
</Steps> </TabsContent> </CodeTabs>import * as React from "react"
import {
ScrubBarContainer,
ScrubBarProgress,
ScrubBarThumb,
ScrubBarTimeLabel,
ScrubBarTrack,
} from "@/components/ui/scrub-bar"
export function ScrubBarExample() {
const [value, setValue] = React.useState(30)
const duration = 100
return (
<ScrubBarContainer duration={duration} value={value} onScrub={setValue}>
<ScrubBarTimeLabel time={value} />
<ScrubBarTrack className="mx-2">
<ScrubBarProgress />
<ScrubBarThumb />
</ScrubBarTrack>
<ScrubBarTimeLabel time={duration} />
</ScrubBarContainer>
)
}
The main container for the scrub bar components. It provides the context for its children.
| Prop | Type | Description |
| -------------- | ------------------------ | ----------------------------------------------------- |
| duration | number | Required. The total duration of the timeline. |
| value | number | Required. The current value of the timeline. |
| onScrub | (time: number) => void | Optional. Callback when the user scrubs the timeline. |
| onScrubStart | () => void | Optional. Callback when the user starts scrubbing. |
| onScrubEnd | () => void | Optional. Callback when the user ends scrubbing. |
The track for the scrub bar. It handles the pointer events for scrubbing.
This component accepts standard HTMLDivElement attributes.
Displays the progress on the scrub bar track.
This component is a wrapper around the Progress component and accepts its props, except for value.
The handle for scrubbing.
This component accepts standard HTMLDivElement attributes.
A label to display time.
| Prop | Type | Description |
| -------- | -------------------------- | -------------------------------------------------------------------------- |
| time | number | Required. The time to display, in seconds. |
| format | (time: number) => string | Optional. A function to format the time into a string. Defaults to m:ss. |
ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā