Prerequisites
- A React project with Tailwind CSS. The components ship a little Tailwind for layout. Replace it with your own CSS if you prefer.
- A BeyondWords project ID and a source ID (or content ID) for the audio you want to play. The examples below use a public demo project.
You don’t need to install
@beyondwords/player yourself. It’s listed as a dependency of the components, so the
CLI adds it for you.Add a component
Add the Play Pause Button. No configuration is needed. The CLI resolves its dependencies automatically, so this also pulls in Player Provider and New Event, plus the@beyondwords/player package.
components.json, the CLI delegates the install to
shadcn, so your aliases and styles config are
respected. Without one, it copies the files to components/beyondwords/ (it
asks first). Adjust the @/registry/react/ import paths in these docs to
wherever the files landed.
Build your first player
Wrap your UI inPlayerProvider. It mounts
the player and shares the instance with everything inside it. Pass the player
config through args, and set showUserInterface: false to hide the player’s
built-in UI so yours is the only one on the page.
app.tsx
app.tsx
projectId and contentId:
Using the shadcn CLI instead (optional)
The registry also works with the shadcn CLI directly. Add components by full URL:components.json, then use
short names:
components.json
Next steps
Theming
Style the components to match your brand.
Player Provider
Read player state and drive playback.
Examples
Start from a complete, pre-built player.
Troubleshooting
Fix common setup issues.