Coder Social home page Coder Social logo

attilacsanyi / connect-button Goto Github PK

View Code? Open in Web Editor NEW

This project forked from radixdlt/connect-button

0.0 0.0 0.0 2.33 MB

License: Apache License 2.0

Shell 0.14% JavaScript 3.67% TypeScript 92.57% CSS 1.41% HTML 0.04% Smarty 1.72% Dockerfile 0.44%

connect-button's Introduction

License

The √ Connect Button is a framework agnostic web component to help developers connect users and their Radix Wallet to their dApps.

It appears as a consistent, Radix-branded UI element that helps users identify your dApp website as a Radix dApp. When used with Radix dApp Toolkit it is compatible with the Radix Wallet – and it automatically provides a consistent user experience for users to connect with their wallet and see the current status of the connection between dApp and Radix Wallet.

Installation

Using NPM

npm install @radixdlt/connect-button

Using Yarn

yarn add @radixdlt/connect-button

Usage

Getting started

Add the <radix-connect-button /> element in your HTML code and call the configuration function.

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  </head>
  <body>
    <radix-connect-button />
  </body>
</html>

Properties

const radixConnectButton = document.querySelector('radix-connect-button')!

const handleConnect = () => {
  radixConnectButton.status = 'pending'
}

radixConnectButton.addEventListener('onConnect', handleConnect)
type ConnectButtonProperties = {
  theme: RadixButtonTheme
  dAppName: string
  personaLabel: string
  connected: boolean
  status: RadixButtonStatus
  loggedInTimestamp: string
  showPopover: boolean
  requestItems: RequestItem[]
  accounts: Account[]
  personaData: PersonaData[]
  isMobile: boolean
  isWalletLinked: boolean
  isExtensionAvailable: boolean
  fullWidth: boolean
  activeTab: 'sharing' | 'requests'
  mode: RadixButtonMode
  avatarUrl: string
}
  • theme - defaults to radix-blue, other values are black, white and white-with-outline
  • dAppName - name of the dApp
  • personaLabel - label of the connected persona
  • connected - set connected state
  • status - set current button status, can be one of default, error, pending, success
  • loggedInTimestamp - timestamp of login
  • showPopover - display connect button popover
  • requestItems - displays a list of maximum 3 request items in the popover
  • accounts - displays a list of connected accounts
  • personaData - list of persona fields together with values
  • isMobile - display mobile placeholder
  • isWalletLinked - marks card during onboarding process as completed
  • isExtensionAvailable - marks card during onboarding process as completed
  • fullWidth - makes the button full width in its container
  • activeTab - changes active tab inside popover
  • mode - set styling of a popover

Events

type ConnectButtonEvents = {
  onConnect: () => void
  onDisconnect: () => void
  onCancelRequestItem: (event: CustomEvent<{ id: string }>) => void
  onDestroy: () => void
  onShowPopover: () => void
  onUpdateSharedData: () => void
}
  • onConnect - triggers when user clicks connect now button
  • onDisconnect - triggers when user clicks disconnect wallet button
  • onCancelRequestItem - triggers when user cancels connect request
  • onDestroy - triggers when button is removed from the DOM. Useful for cleaning up registered event listeners and subscriptions.
  • onShowPopover - triggers when users clicks on radix button and popover is being shown
  • onUpdateSharedData - triggers when users clicks on "Update Shared Data" button

License

The √ Connect Button code is released under Apache 2.0 license. Binaries are licensed under the Radix Software EULA

connect-button's People

Contributors

xstelea avatar dawidsowardx avatar marek-karwacki-rdx avatar duje-begonja-rdx avatar ymatto avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.