Leaderboard Component
The Leaderboard component efficiently displays and manages leaderboards in React, offering customizable styling. Users can easily monitor progress and compete through its clear interface.
Component Visuals

Installation
To install the Quest react-sdk into your project, follow these steps:
Open your terminal/command prompt.
Navigate to your project's root directory using the
cdcommand if you're not already there.Run the following command to install the
quest-sdkpackage using npm:
npm install @questlabs/react-sdkThis command will download and install the package and its dependencies into your project.
The LeaderBoardcomponent accepts the following props
Usage
To integrate the LeaderBoard component into your React application, follow these steps
Import the CSS: In your JavaScript or TypeScript file where you're using the
LeaderBoard, import the CSS styles for the component. This ensures that the component's styling is applied correctly.
import '@questlabs/react-sdk/dist/style.css'Import the TutorialComponent: Import the
LeaderBoardcomponent from the@questlabs/react-sdkpackage.Import the QuestProvider Component: Import the
QuestProvidercomponent from the@questlabs/react-sdkpackage.
import { QuestProvider, LeaderBoard } from '@questlabs/react-sdk';Pass the Required Props: Pass the required props to the
QuestProvider. The required props areapiKey, andentityId. and required props for theLeaderBoardcomponent areuserId, questId, token
Code & Steps
import { QuestProvider, LeaderBoard } from '@questlabs/react-sdk';
import '@questlabs/react-sdk/dist/style.css'
function App() {
return (
<QuestProvider
apiKey="your-apikey"
entityId="your-entity-Id"
apiType= "PRODUCTION" // STAGING
>
<LeaderBoard> </LeaderBoard>
</QuestProvider>
);
}
export default App;
<LeaderBoard
userId=""
questId=""
token=""
uniqueUserId="your-unique-user-id"
>
// children
</LeaderBoard ><LeaderBoard.Header
heading='your-heading'
style= {{ backgroundcolor : 'white' }}
/><QuestProvider
apiKey="your-apikey"
entityId="your-entity-Id"
apiType="PRODUCTION" // STAGING
>
<LeaderBoard
userId=""
questId=""
token=""
uniqueUserId="your-unique-user-id"
>
<LeaderBoard.Header />
<LeaderBoard.Content />
<LeaderBoard.Footer />
</LeaderBoard >
</QuestProvider>Example Usage
Here's an example of how to use the LeaderBoardcomponent within your React application
import { QuestProvider, LeaderBoard } from '@questlabs/react-sdk';
import '@questlabs/react-sdk/dist/style.css'
function App() {
return (
<div>
<QuestProvider
apiKey="your-apikey"
entityId="your-entity-Id"
apiType= "PRODUCTION" // STAGING
>
<LeaderBoard
userId=""
questId=""
token=""
uniqueUserId="your-unique-user-id"
>
<LeaderBoard.Header />
<LeaderBoard.Content />
<LeaderBoard.Footer />
</LeaderBoard>
</QuestProvider>
</div>
);
}
export default App;import { QuestProvider, TutorialWrapper } from '@questlabs/react-sdk';
import '@questlabs/react-sdk/dist/style.css'
function App() {
return (
<div>
<QuestProvider
apiKey="your-apikey"
entityId="your-entity-Id"
apiType="PRODUCTION" // STAGING
>
<LeaderboardWrapper
userLimit={50}
isXpImage={true}
userId={userId}
token={token}
setPresentUserData={setPresentData}
presentUserRank={presentRank}
setPresentUserRank={setPresentRank}
DefaultImage=""
DefaultName=""
FirstRankIconImage=""
IsTopRank={true}
SecondRankIconImage=""
ThirdRankIconImage=""
rewardHead=""
uniqueEmailId=""
uniqueUserId=""
userImageUrl=""
userName=""
styleConfig={{
PresentUser: {},
Description: {},
Footer: {
FooterIcon: {},
FooterLink: "",
FooterStyle: {},
FooterText: "",
FooterTextStyle: {}
},
Form: {},
Heading: {},
IconStyle: {
color: ""
},
IndexBackground: {},
IndexColor: {},
InnerBackground: {},
MainHeading: {},
PointsBackground: {},
PointsColor: {},
ProgressBarColor: {}
}}
isLoader={true}
/>
</QuestProvider>
</div>
);
}
export default App;Props of Leaderboard Component
The Leaderboard component accepts the following props:
token
string
required
An authentication token or API key necessary for accessing Leaderboard or quest data.
userId
string
required
The unique identifier of the user.
styleConfig
object
optional
An object containing CSS properties for styling various components within the Leaderboard process, including main heading, heading, descriptions, points color,,points background,inner background, index color, index background , progressbar color, and icon style .
userLimit
number
optional
Limits the user
isXpImage
boolean
optional
Hide or show Xp image
DefaultImage
string
optional
To set default image
DefaultName
string
optional
To set default Nmae
FirstRankIconImage
string
optional
To set the image of first ranker
SecondRankIconImage
string
optional
To set the image of second ranker
ThirdRankIconImage
string
optional
To set the image of third ranker
IsTopRank
boolean
optional
To tell top rank or not
styleConfig = {{
PresentUser: { },
Description: { },
Footer: {
FooterIcon: { },
FooterLink: "",
FooterStyle: { },
FooterText: "",
FooterTextStyle: { }
},
Form: { },
Heading: { },
IconStyle: {
color: ""
},
IndexBackground: { },
IndexColor: { },
InnerBackground: { },
MainHeading: { },
PointsBackground: { },
PointsColor: { },
ProgressBarColor: { }
}}Features
Customizable Styling: Users can customize the appearance of the leaderboard to align with their platform's branding or design preferences. This includes options to adjust colors, fonts, and layout, providing a seamless integration into the overall user interface.
Versatile Leaderboard Component: Integrate a comprehensive leaderboard feature into your app, enabling dynamic tracking and visualization of user standings based on accumulated points or experience. Tailor the leaderboard to suit diverse engagement scenarios and foster competition and community interaction within your platform.
You can customize the UI with type of styleConfig would be
Last updated