Waveform Bars

Mic toggle with animated waveform bars and pulse state.

Preview

Click the mic to toggle the waveform bars!

Installation

1. Run the following command in your terminal:
npx shadcn@latest add https://refinery.abhii.me/r/waveform-bars.json

API Reference

Component props
NameTypeDescription
colorstringColor class for the container and bars. Accepts any CSS color string.
iconSizestringSize class for the microphone icon.
barCountnumberNumber of bars in the waveform. Default is 7.
defaultOpenbooleanInitial open state for uncontrolled usage.
openbooleanControlled open state.
onOpenChange(open: boolean) => voidCallback fired when open state changes.

Usage Recommendations

Pair with voice or recording actions near the control that triggers it.
Keep bar colors aligned with your primary brand accent.
Design Notes

Toggled state is used to drive the button position, scale, and background color with Motion. The waveform itself is a row of bars with staggered height animations that only loop while the control is active. You can adjust the bar count and color, or pair it with your own recording state through the controlled props.