Composition#

Bumbag allows you to flexibly build your own components on top of the Bumbag components using a set of composition techniques.

use prop#

You can pass a component to the use prop on any Bumbag component. This can be useful when you want to use a different component but still want to preserve the styling.

A common case could be rendering a link as a button:

Editable example

You can even pass your own components to use:

Editable example

Hooks#

You can also use hooks to leverage Bumbag's components. Every Bumbag component comes with a useProps hook.

The first and only parameter to useProps are the props for the component.

Editable example

Render props#

As an alternative to the useProps hook, every Bumbag component also accepts children as a function (render props).

Editable example
Copyright © 2021 Jake Moxey