XiodUI
HomeDocs
OverviewComponentsStyling & CustomizationChangelog

Components

  • Accordion
  • Agent Steps
  • Alert
  • Alert Dialog
  • Aspect Ratio
  • Autocomplete
  • Avatar
  • Badge
  • Breadcrumb
  • Button
  • Button Group
  • Button Split
  • Calendar
  • Card
  • Carousel
  • Checkbox
  • Circular Progress
  • Collapsible
  • Color Picker
  • Combobox
  • Command
  • Context Menu
  • Copy To Clipboard
  • Corner Badge
  • Dashboard Grid
  • Date Picker
  • Dialog
  • Dot Matrix
  • Draggable
    Updated
  • Drawer
  • Empty
  • Field
  • Fieldset
  • File Upload
    Updated
  • Form
  • Frame
  • Gauge
  • Grid
  • Group
  • Input
  • Input Group
  • Input OTP
  • Input Payment
  • Input Phone
    Updated
  • Input Sensitive
  • Kbd
  • Kinetic Click
  • Label
  • List Box
    Updated
  • Loader
  • Marker
  • Menu
  • Menubar
  • Message
  • Meter
  • Morphic Toast
  • Navigation Menu
  • Number Field
  • Option Picker
  • Orb
  • Pagination
  • Popover
  • Preview Card
    Updated
  • Progress
  • Radio
  • Resizable
  • Ruler Picker
  • Scroll Area
  • Scroll Bar
  • Select
  • Separator
  • Sidebar
  • Skeleton
  • Slider
  • Sortable
  • Switch
  • Table
  • Tabs
  • Text
  • Textarea
  • Timeline
  • Toast
  • Toggle
  • Toggle Group
  • Toolbar
  • Tooltip
  • Waveform
  • Wheel Picker

Loading...

Preview Skeleton

Installation Skeleton

Usage Skeleton

API Reference Skeleton

Sponsors

Support the development of XiodUI and help us build the best component library on Earth.

+++
Sponsor on GitHub

Waveform

Previous: TooltipNext: Wheel Picker

An audio waveform, from a file or a live microphone, with scrubbing.

Preview

Loading Preview...

Installation

bun add xiod-ui

Usage

Imports

1import {2  Waveform,3  WaveformVisual,4  WaveformScrubber,5  WaveformHandle6} from "xiod-ui/waveform";

Anatomy

1<Waveform>2  <WaveformVisual />3  <WaveformScrubber />4  <WaveformHandle />5</Waveform>

API Reference

Detailed documentation of properties and options.

Waveform

Accepts render, plus every native <div> attribute.

PropTypeDefaultDescription
active
boolean
false

Whether the waveform shows live input instead of a recording. With microphone, the microphone is recorded while this is true.

barColor
TooltipWheel Picker
string
–

The colour of bars not yet played, as a CSS colour. Defaults to the --border token.

barGap
number
2

The space between bars, in pixels.

barRadius
number
1.5

The corner radius of each bar, in pixels. 0 gives square bars.

barWidth
number
3

The width of each bar, in pixels.

data
number[]
–

The bar heights to draw, each from 0 to 1. They are stretched to fill the width.

defaultValue
number
–

The playback position at first, when it isn't controlled.

deviceId
string
–

The microphone to record from, as a deviceId from navigator.mediaDevices.enumerateDevices(). Uses the default microphone when unset.

duration
number
1

The total length, in the same unit as value. Leave it at 1 to use value as a fraction from 0 to 1.

fadeEdges
boolean
true

Whether the bars fade out towards the left and right edges.

fadeWidth
number
24

How far the fade reaches in from each edge, in pixels.

labels
Partial<WaveformLabels>
–

Replaces the built-in text for this instance. See LabelsProvider to change it everywhere.

microphone
boolean
false

Whether to record from the microphone while active. The browser asks the user for permission first.

mode
"static"|"scrolling"|"live"
static

How live input is drawn: scrolling adds each sample at the right edge and moves older ones left; static and live redraw the bars across the full width.

onMicrophoneError
((error: unknown) => void)
–

Called when the microphone can't be used, for example when the user denies permission or no microphone is connected.

onValueChange
((value: number) => void)
–

Called with the new position when the user clicks or drags to seek.

processing
boolean
false

Whether to show a gently moving wave, for example while an assistant is thinking. Ignored while active.

progressColor
string
–

The colour of played bars and of live input, as a CSS colour. Defaults to the --primary token.

seed
number
42

A number that picks the placeholder waveform drawn when there's no data. The same seed always draws the same shape.

sensitivity
number
1

How strongly microphone input moves the bars. Raise it for quiet input.

updateRate
number
30

How often to sample the microphone, in milliseconds.

value
number
–

The playback position, in the same unit as duration. Use with onValueChange to control it.

WaveformVisual

Accepts every native attribute of the element it renders.

WaveformScrubber

Accepts render, plus every native <div> attribute.

WaveformHandle

Accepts render, plus every native <div> attribute.