Subbi
  • What is Subbi?
  • Getting Started
    • Setting up your first subscription
    • Supported tokens
    • Contract links
  • Hosted Checkout
    • Introduction
    • Configuring URLs
  • Self Hosted Checkout
    • Installation
    • Components
      • Subbi Provider
      • Buttons
        • Metamask Button
        • Approve Button
        • Subscribe Button
        • Cancel Button
      • Checkout Flow
    • Hooks
  • Direct contract interaction
    • Introduction
    • Contract ABIs
  • Extras
    • Fee sharing
Powered by GitBook
On this page
  1. Self Hosted Checkout
  2. Components
  3. Buttons

Metamask Button

PreviousButtonsNextApprove Button

Last updated 3 years ago

This button is used to connect to Metamask (or any other injected browser wallet for that matter). It has the following properties:

style (optional): A standard CSS-in-JS style, as seen . Because Subbi uses styled-components under the hood, this includes pseudo elements.

onError (optional): An optional function that is called if any of the components encounter an error. It is passed one argument: the error object in question.

interface Props {
    style?: {
      [x: string]: string | number | {};
    } & React.CSSProperties;
    onError?: (error: any) => void | Promise<void>;
}

Usage

import { MetamaskButton } from "@subbi/react";

<MetamaskButton
    style={{ backgroundColor: 'red' }}
    onError={(error: any) => console.log(error)}
/>
here