Skip to content
Matt Layton edited this page Apr 13, 2020 · 2 revisions

By default, an HTML button has an implicit type of submit. Here we override that default to be button, since this is more common and often otherwise forgotten.

Usage

<Button onClick={Function.prototype}>Call to action!</Button>

Styled components also ships with the as prop which in this case, for example, can allow you to render the component as a hyperlink instead of a button, whilst maintaining the button styles:

<Button as="a" href="/">Go to page!</Button>

API

Prop PropType Default Description
type String "button" HTML button type attribute

Clone this wiki locally