Overview
The ZKScore React SDK provides pre-built components for common use cases, including score displays, identity cards, achievement lists, and leaderboards. All components are fully customizable and support both ZKS IDs and wallet addresses.
All components automatically handle ZKS ID resolution, so you can use either ZKS IDs (like alice.zks) or wallet addresses. The SDK will resolve them to the appropriate format.
Core Components
ScoreCard
Display a user’s current score with optional breakdown.
Props:
identity (string, required): ZKS ID or wallet address
showBreakdown (boolean): Show detailed breakdown
showHistory (boolean): Show historical data
realTime (boolean): Enable real-time updates
className (string): CSS class name
style (object): Inline styles
IdentityCard
Display identity information with metadata.
Props:
identity (string, required): ZKS ID or wallet address
showMetadata (boolean): Show metadata
showAvatar (boolean): Show avatar image
showSocial (boolean): Show social links
layout (string): Layout type (horizontal, vertical)
size (string): Component size (small, medium, large)
AchievementList
Display a list of achievements for a user.
Props:
identity (string, required): ZKS ID or wallet address
category (string): Filter by category
status (string): Filter by status
limit (number): Number of achievements to show
showProgress (boolean): Show progress bars
showRarity (boolean): Show rarity indicators
layout (string): Layout type (list, grid)
ScoreHistory
Display historical score data as a chart.
Props:
identity (string, required): ZKS ID or wallet address
timeframe (string): Time period (1d, 7d, 30d, 90d, 1y, all)
interval (string): Data interval (hourly, daily, weekly, monthly)
chartType (string): Chart type (line, bar, area)
showTooltip (boolean): Show tooltips
showLegend (boolean): Show legend
height (number): Chart height in pixels
Leaderboard
Display a leaderboard of users.
Props:
category (string): Filter by category
metric (string): Ranking metric (score, points, achievements)
limit (number): Number of entries to show
timeframe (string): Time period for ranking
showRank (boolean): Show rank numbers
showAvatar (boolean): Show user avatars
showScore (boolean): Show scores
layout (string): Layout type (table, list, grid)
Advanced Components
TrustScore
Display trust score and attestations.
AchievementProgress
Display progress for a specific achievement.
ScoreBreakdown
Display detailed score breakdown.
Layout Components
ProfileLayout
Complete user profile layout.
Props:
identity (string, required): ZKS ID or wallet address
sections (array): Sections to include
layout (string): Layout type (sidebar, tabs, grid)
showNavigation (boolean): Show navigation
showSocial (boolean): Show social links
DashboardLayout
Dashboard layout with multiple components.
Customization
Styling
All components support custom styling through CSS classes and inline styles.
CSS Custom Properties
Components use CSS custom properties for theming.
Theme Override
Component Composition
Custom Score Display
Custom Achievement Grid
Responsive Design
Mobile-First Approach
Accessibility
ARIA Labels
Keyboard Navigation
Lazy Loading
Memoization
Best Practices
1. Component Composition
2. Error Boundaries
3. Loading States