
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
openbadges-ui
Advanced tools
Vue 3 component library for implementing Open Badges functionality with accessibility and customization
A Vue 3 component library for implementing Open Badges functionality, with a focus on accessibility and customization. This library supports both Open Badges 2.0 and 3.0 specifications.
Note: This package is part of the Rollercoaster.dev monorepo. For development instructions, see the monorepo documentation.
# Using bun (recommended)
bun add openbadges-ui openbadges-types
# Using npm
npm install openbadges-ui openbadges-types
# Using yarn
yarn add openbadges-ui openbadges-types
This package is already configured within the monorepo. To work on it:
# From monorepo root
bun install
# Run Histoire dev server
bun --filter openbadges-ui run story:dev
# Run tests
bun --filter openbadges-ui test
# Build package
bun --filter openbadges-ui run build
import { createApp } from "vue";
import App from "./App.vue";
import { OpenBadgesUIPlugin } from "openbadges-ui";
// Import styles
import "openbadges-ui/dist/style.css";
const app = createApp(App);
// Use the plugin (configures PrimeVue in unstyled mode)
app.use(OpenBadgesUIPlugin);
app.mount("#app");
The library exports utility functions for working with Open Badges data:
typeIncludes(typeValue, targetType)Checks if a type value includes a specific type string. Handles both OB2 (string or array) and OB3 (array) formats.
import { typeIncludes } from "openbadges-ui";
// OB2 string format
typeIncludes("Assertion", "Assertion"); // true
// OB3 array format
typeIncludes(
["VerifiableCredential", "OpenBadgeCredential"],
"VerifiableCredential",
); // true
// Edge cases
typeIncludes(undefined, "Assertion"); // false
typeIncludes([], "Assertion"); // false
Why this is needed: Open Badges 2.0 allows type to be a string OR array, while OB3 requires an array. This utility provides consistent type checking across both formats.
isOB2Assertion(badge) - Type guard for OB2 assertionsisOB3VerifiableCredential(badge, strict?) - Type guard for OB3 credentialsvalidateOB3Context(context) - Validates @context structurecreateIRI(url) - Creates IRI branded typecreateDateTime(dateTimeString) - Creates DateTime branded typeOB2Guards - Namespace with OB2 type guards (IdentityObject, VerificationObject, Evidence, etc.)OB3Guards - Namespace with OB3 type guards (Proof, CredentialStatus, Issuer, etc.)Open Badges 3.0 (OB3) credentials use JSON-LD @context to define vocabulary and semantics. This library validates @context in OB3 VerifiableCredentials according to the W3C Verifiable Credentials and OB3 specifications.
The @context field accepts three formats:
1. String (single context URI)
{
"@context": "https://www.w3.org/2018/credentials/v1"
}
2. Array (multiple contexts) - Recommended
{
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://purl.imsglobal.org/spec/ob/v3p0/context.json"
]
}
3. Object (embedded context)
{
"@context": {
"@vocab": "https://www.w3.org/2018/credentials#",
"ob": "https://purl.imsglobal.org/spec/ob/v3p0/vocab#"
}
}
When using array format, the following contexts must be present:
| Context | Required URIs (any of) |
|---|---|
| W3C Verifiable Credentials | https://www.w3.org/2018/credentials/v1 or https://www.w3.org/ns/credentials/v2 |
| Open Badges 3.0 | https://purl.imsglobal.org/spec/ob/v3p0/context.json or URLs containing purl.imsglobal.org/spec/ob/v3p0 or openbadges.org/spec/ob/v3p0 |
Use the type guard with strict mode for complete validation:
import { isOB3VerifiableCredential } from "openbadges-ui";
// Non-strict (default): validates structure, not context URIs
if (isOB3VerifiableCredential(badge)) {
// badge has required OB3 fields
}
// Strict: also validates @context has required URIs (for array format)
if (isOB3VerifiableCredential(badge, true)) {
// badge has valid structure AND proper context
}
For direct context validation:
import { validateOB3Context } from "openbadges-ui";
const result = validateOB3Context(badge["@context"]);
if (!result.valid) {
console.error(result.error); // e.g., "@context must include Open Badges 3.0 context"
}
The library uses a CSS custom property token contract for theming. Tokens are organized in three tiers — foundational primitives, semantic tokens (the public API), and component tokens — so you can customize appearance without modifying component source code.
Override semantic tokens to create a custom theme:
.my-brand {
--ob-primary: #8b5cf6;
--ob-primary-foreground: #ffffff;
--ob-background: #faf5ff;
--ob-foreground: #1e1b4b;
}
Built-in themes (apply via CSS class or AccessibilityService):
| Class | Description |
|---|---|
.ob-dark-theme | Dark mode |
.ob-high-contrast-theme | WCAG AAA contrast |
.ob-large-text-theme | Larger fonts and line heights |
.ob-dyslexia-friendly-theme | OpenDyslexic font, cream background, extra spacing |
.ob-low-vision-theme | Atkinson Hyperlegible, high contrast, large text |
.ob-low-info-theme | Simplified palette, reduced distractions |
.ob-autism-friendly-theme | Predictable layouts, muted colours, no shadows |
import { AccessibilityService } from "openbadges-ui";
AccessibilityService.applyTheme("dark");
<body class="ob-dark-theme">
<!-- Components use dark theme tokens -->
</body>
For the full token reference, override examples, and ND theme guide, see docs/theming.md.
This library prioritizes accessibility with:
The library includes Histoire integration for component development and documentation:
# Run Histoire development server (from monorepo root)
bun --filter openbadges-ui run story:dev
# Or from package directory
bun run story:dev
# Build static Histoire site
bun run story:build
# Preview the built Histoire site
bun run story:preview
Histoire provides interactive examples of all components with different configurations and themes.
You can view the live component documentation at https://rollercoaster-dev.github.io/openbadges-ui/
The library includes unit and integration tests for components and services using Vitest + Vue Test Utils:
# Run tests (from monorepo root)
bun --filter openbadges-ui run test
# Or from package directory
bun run test
# Run tests with coverage
bun run test:coverage
# Watch mode
bun run test:watch
Test Results: ✅ 195/195 tests passing (100%)
Important: Always use bun run test (not bun test). The difference:
bun run test → Runs Vitest (✅ all tests pass)bun test → Runs Bun's native test runner (❌ fails with .vue files)Bun's native test runner doesn't support Vue Single File Components (Issue #5967).
Check out the examples directory for sample applications demonstrating how to use the OpenBadges UI components.
This package is part of the Rollercoaster.dev monorepo. See the monorepo CONTRIBUTING.md for general contribution guidelines.
When making changes to this package:
# From monorepo root
bunx changeset
openbadges-ui when promptedThis monorepo uses Changesets for version management and publishing. When your PR is merged:
See the monorepo documentation for more details.
FAQs
Vue 3 component library for implementing Open Badges functionality with accessibility and customization
The npm package openbadges-ui receives a total of 11 weekly downloads. As such, openbadges-ui popularity was classified as not popular.
We found that openbadges-ui demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.