TheBadge documentation
  • 👨‍🏫TheBadge's Introduction
    • Relevance
  • 💎Landing page
  • 🏅What is a Badge
    • Definition
    • Badge history
    • Badge Categories
      • Community Badges
      • Third-party Badges
  • 🫂Protocol Participants
    • Creators
    • Curators
    • Badge Receiver
    • Badge Types
    • Badge Status
  • ⚙️Protocol Mechanics
    • How it works
    • Challenge
    • Challenge Flow
  • 📚How to / Guides
    • How to get a badge
    • How to create a badge
    • How to become a creator
    • How to become a curator
    • How to curate
    • How to challenge
    • How to claim a third party certificate
    • How to place your diploma on LinkedIn
  • ⛓️Integration Guide
    • How to fetch badges
    • How to render badges
      • Using the TheBadge-UI-Library
  • 🙂Community
    • TheBadge's Ambassador
Powered by GitBook
On this page

Was this helpful?

  1. Integration Guide
  2. How to render badges

Using the TheBadge-UI-Library

PreviousHow to render badgesNextTheBadge's Ambassador

Last updated 1 year ago

Was this helpful?

Available components

  • The UI-Lib contains a lot of components and different formats for displaying the badges, you can check them and access to the docs in .

  • Please note that the library it's still under development.

  • The library repository can be found .

1) First you have to install the library:

yarn add thebadge-ui-library

2) Then import CSS files with styles in your _app.tx file:

import 'node_modules/thebadge-ui-library/dist/index.css'

3) Now you can use the component by providing to it the badge metadata

Example with BadgePreviewV2:

{
    "badge": {
      "id": "0x51fd663a6b85383c96e229ec12c0882eaa9886fe-8",
      "evidenceMetadataUrl": "ipfs://QmYVn1MGonZ6n1VKN8M7fEeGtfLeyjGSztFDEaTHqERcgD", -> contains the imageUrl
      "reviewDueDate": "1680277596",
      "status": "InReview",
      "isChallenged": false,
      "receiver": {
        "id": "0x51fd663a6b85383c96e229ec12c0882eaa9886fe"
      },
      "badgeType": {
        "id": "8",
        "metadataURL": "ipfs://QmaMdeyvZbgo2v5rKxopdZ6CFuJd95V2Lp3hmoWYYer4jJ", -> contains the badgeTypeMetadata
        "validFor": "0",
        "badgesMintedAmount": "0"
      }
    }
  }
imageUrl: "https://gateway.pinata.cloud/ipfs/QmZnKDwa7rkJEraPKVuDHSeQGCKuamG8WyxpNfZ9jm9qye"
const badgeTypeMetadata = {
    "description": "Proof of ownership of a Mercado Libre Sellers account",
    "image":"ipfs://QmW3hVcLJ1a5fD9yeKCLuoKB3WbZGY7kfxg66Hx53Wkk3n",
    "name":"Proof of Merchant Account in MercadoLibre"
}
<BadgePreviewV2
  imageUrl={badgeTypeMetadata.imageUrl} -> it should be an url, ipfs not supported at the moment
  size="medium" -> Large / Medium / Small
  title={badgeTypeMetadata.name}
  description={badgeTypeMetadata.description}
  badgeUrl={`staging-app.thebadge.xyz/${badgeType.id}/${ownerAddress}`}

  {/** NON-EDITABLE VALUES (under development) **/}
  animationEffects={['wobble', 'grow', 'glare']}
  animationOnHover
  badgeBackgroundUrl="https://images.unsplash.com/photo-1512998844734-cd2cca565822?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MTIyfHxhYnN0cmFjdHxlbnwwfHwwfHw%3D&auto=format&fit=crop&w=500&q=60"
  textContrast="light-withTextBackground"
/>

It will look like this:

⛓️
Storybook
here
Badge example