Audio

A wrapper around the HTML audio element

This is (currently) a simple wrapper around the HTML audio element.

It inverts a couple of the standards that the raw element has, such as showing controls by default.

You can provide either a src prop with a path to a single file, or multiple child <source> elements. If you provide both, the src prop will be ignored.

Props

Prop nameTypeDefaultDescription
childrenunionnullThe content of the Audio component. Should be a <source> element or React component that ultimately resolves in a <source> element
classNamestringnullA custom className you would like to pass to the Component
hideControlsboolfalseWhether or not the controls should be hidden
shouldAutoplayboolfalseWhether or not the audio should play automatically
shouldLoopboolfalseWhether or not the audio file should be looped
srcstringnullA path to a single source. Is ignored if children are passed in, as well.