Multiple Widgets
Display multiple DotPassport widgets together.
Dashboard Layout
Create a complete reputation dashboard:
<!DOCTYPE html>
<html>
<head>
<style>
.dashboard {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 1.5rem;
padding: 1.5rem;
}
.widget-card {
border-radius: 12px;
overflow: hidden;
}
</style>
</head>
<body>
<div class="dashboard">
<div class="widget-card" id="reputation"></div>
<div class="widget-card" id="badges"></div>
<div class="widget-card" id="profile"></div>
</div>
<script type="module">
import { createWidget } from '@dotpassport/sdk';
const API_KEY = 'your_api_key';
const ADDRESS = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY';
const widgets = [];
// Reputation widget
const reputation = createWidget({
apiKey: API_KEY,
address: ADDRESS,
type: 'reputation',
showCategories: true
});
reputation.mount('#reputation');
widgets.push(reputation);
// Badge widget
const badge = createWidget({
apiKey: API_KEY,
address: ADDRESS,
type: 'badge',
maxBadges: 6
});
badge.mount('#badges');
widgets.push(badge);
// Profile widget
const profile = createWidget({
apiKey: API_KEY,
address: ADDRESS,
type: 'profile'
});
profile.mount('#profile');
widgets.push(profile);
// Cleanup on page unload
window.addEventListener('beforeunload', () => {
widgets.forEach(w => w.destroy());
});
</script>
</body>
</html>React Dashboard
Category Grid
Display all reputation categories:
Vue Multi-Widget Component
Widget Manager Pattern
Centralize widget management:
Comparison View
Compare two addresses side by side:
Related
Last updated
