Installation
Add waves-cn components to your project using the shadcn/ui registry.
Prerequisites
waves-cn components are plain shadcn/ui components. You need:
- React 18 or newer
- Tailwind CSS v4
- shadcn/ui initialised in the project (
components.jsonpresent)
If you have not set up shadcn/ui yet:
pnpm dlx shadcn@latest initnpx shadcn@latest inityarn dlx shadcn@latest initbunx --bun shadcn@latest init1. Register the registry
The shadcn CLI only resolves @waves-cn/* names once the namespace is declared in your components.json. Do this once per project, either with the CLI:
pnpm dlx shadcn@latest registry add @waves-cn=https://waves-cn.vercel.app/r/{name}.jsonnpx shadcn@latest registry add @waves-cn=https://waves-cn.vercel.app/r/{name}.jsonyarn dlx shadcn@latest registry add @waves-cn=https://waves-cn.vercel.app/r/{name}.jsonbunx --bun shadcn@latest registry add @waves-cn=https://waves-cn.vercel.app/r/{name}.jsonor by editing components.json by hand:
{
"registries": {
"@waves-cn": "https://waves-cn.vercel.app/r/{name}.json"
}
}2. Add a component
pnpm dlx shadcn@latest add @waves-cn/wave-playernpx shadcn@latest add @waves-cn/wave-playeryarn dlx shadcn@latest add @waves-cn/wave-playerbunx --bun shadcn@latest add @waves-cn/wave-playerThe CLI installs:
- the component at
components/waves-cn/wave-player.tsx - the shared core at
lib/wave-cn.tsx(WavesurferPlayer,useWavePlayer,useWavesurfer,formatTime,useCssVar) - the shadcn primitives it uses (
button,card,slider, …) if they are not already in your project - the
wavesurfer.jsandlucide-reactnpm packages
Every component is listed on its docs page with the exact command. Replace wave-player with any of wave-recorder, wave-regions, wave-timeline, wave-minimap, wave-spectrogram, wave-speed, wave-zoom, wave-hover, wave-envelope, wave-video.
3. Use it
import WavePlayer from "@/components/waves-cn/wave-player";
export default function Page() {
return <WavePlayer src="/track.mp3" title="My track" />;
}Manual installation
Each component page has a Manual tab with the full source of the component and of lib/wave-cn.tsx. Copy both, then install the runtime dependencies:
npm install wavesurfer.js lucide-reactand make sure the shadcn primitives the component imports (button, card, slider, switch, label) exist under components/ui/.