HomePaymentsNo-codeDevelopersContribute
Safepay Home PageLive DashboardTest Dashboard

Button


The Button component provided from the styleguide located in sfpy/styleguide provides a fully featured button component.

Usage

Basic Button usage
  import React, { useEffect } from 'react';
  import { Button } from '@sfpy/styleguide'

  export default function App() {
    return (
      <div style={styles.container}>
        <p>Button Example</p>
        <Button
          size="lg"
          theme="primary"
          leftSlot={<PaletteIcon />}
          disabled={false}
          onClick={() => console.log("button clicked")}
        >
          I am a clickable button
        </Button>
      </div>
    );
  }

Example

Props

Prop NameTypeDefaultDescription
themeenumprimaryThe following themes are available: primary, secondary, primary-destructive, secondary-destructive, tertiary, quaternary
classNamestringundefinedAdditional classnames in tailwind format to style the button
disabledbooleanfalseRender the button as disabled
sizeenumsmThe following sizes are available: xs, sm, md, lg, xl, 2xl
leftSlotReact.ReactElementundefinedUsed to render a React component on the left of the button. Usually used to render Icon adornments.
rightSlotReact.ReactElementundefinedSame as leftSlot but added to the right of the Button
hrefstringundefinedIf href is supplied, the button behaves as a Link which will redirect to the provided href when clicked
openInNewTabbooleanfalseUsed in conjunction with href. Will open the href in a new tab. Similar to target=_blank on <a> tags