Change api to allow passing a parent component.

- Fixes #4.