Getting Started
Components
- Agent Status
- Agent Template Card
- API Key Card
- Audio Player
- Bar Visualizer
- Channel Status Card
- Chat Composer
- Code Editor
- Condition Builder
- Confirm Dialog
- Conversation
- Conversation Bar
- Dataset Card
- Document Status Badge
- Extraction Strategy Select
- File Icon
- File Upload
- Indexing Progress
- Live Waveform
- Matrix
- Message
- Mic Selector
- Model Diff View
- Model Selector
- Model Type Filter
- Node Catalog
- Option Editor
- Orb
- Output Variables View
- Package Card
- Prompt Editor
- Provider Status Card
- Radio Card
- Resource Card
- Resource Sidebar
- Response
- Run Node List
- Scrub Bar
- Segment Card
- Shimmering Text
- Speech Input
- Token Trend Chart
- Tool Call Card
- Transcript Viewer
- Usage Stat Card
- Variable Binding Editor
- Variable Selector
- Voice Button
- Voice Picker
- Waveform
- Workflow Node Card
- Workspace Selector
0:301:40
"use client"
import * as React from "react"
import {
ScrubBarContainer,
ScrubBarProgress,
ScrubBarThumb,
ScrubBarTimeLabel,
ScrubBarTrack,
} from "@/components/ui/scrub-bar"
const ScrubBarDemo = () => {
const [value, setValue] = React.useState(30)
const [isScrubbing, setIsScrubbing] = React.useState(false)
const duration = 100
return (
<div className="flex w-full max-w-sm flex-col items-center gap-4 p-4">
<ScrubBarContainer
duration={duration}
value={value}
onScrub={setValue}
onScrubStart={() => setIsScrubbing(true)}
onScrubEnd={() => setIsScrubbing(false)}
className="w-full"
>
<ScrubBarTimeLabel time={value} className="w-10 text-center" />
<ScrubBarTrack className="mx-2">
<ScrubBarProgress />
<ScrubBarThumb className="bg-primary" data-scrubbing={isScrubbing} />
</ScrubBarTrack>
<ScrubBarTimeLabel time={duration} className="w-10 text-center" />
</ScrubBarContainer>
</div>
)
}
export ScrubBarDemo
Installation
pnpm dlx shadcn@latest add https://ui.zgi.ai/r/scrub-bar.json
Usage
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>
)
}API Reference
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. |
ScrubBarTrack
The track for the scrub bar. It handles the pointer events for scrubbing.
This component accepts standard HTMLDivElement attributes.
ScrubBarProgress
Displays the progress on the scrub bar track.
This component is a wrapper around the Progress component and accepts its props, except for value.
ScrubBarThumb
The handle for scrubbing.
This component accepts standard HTMLDivElement attributes.
ScrubBarTimeLabel
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. |
Deploy and Scale Agents with ZGI
ZGI delivers the infrastructure and developer experience you need to ship reliable audio & agent applications at scale.
Talk to an expert