@molecule/app-achievement-card-solid

Feature · achievement-card · App (browser) · v1.1.2 · Apache-2.0

Badge / achievement unlock card with icon + name + description + earned-at

npm install @molecule/app-achievement-card-solid

npm · Source on GitHub

How it works

@molecule/app-achievement-card-solid is a ready-made achievement-card feature for the app (browser) side. It composes the core interfaces it needs, so it works with whichever providers your app has bonded.

import { AchievementCard } from '@molecule/app-achievement-card-solid'

;<AchievementCard
  icon={<span>🏆</span>}
  name="First Login"
  description="Signed in for the first time."
  earned
  earnedAt="Jan 3, 2025"
  tier="Common"
/>

Works with: @molecule/app-i18n, @molecule/app-solid, @molecule/app-ui, @molecule/app-ui-solid

Reference

Solid badge / achievement unlock card.

Exports AchievementCard — the Solid counterpart of @molecule/app-achievement-card-react with the same props, the same ClassMap tokens and the same DOM for the same input. Locked achievements render greyed-out; in-progress ones show a progress bar.

Auto-generated, AI-first package reference for the molecule.dev ecosystem. It is written to be read by coding agents as much as by people, and is generated from this package's source — edit src/index.ts JSDoc, not this file.

Quick Start

import { AchievementCard } from '@molecule/app-achievement-card-solid'

;<AchievementCard
  icon={<span>🏆</span>}
  name="First Login"
  description="Signed in for the first time."
  earned
  earnedAt="Jan 3, 2025"
  tier="Common"
/>

Type

feature

Installation

npm install @molecule/app-achievement-card-solid @molecule/app-i18n @molecule/app-solid @molecule/app-ui @molecule/app-ui-solid solid-js

API

Interfaces

AchievementCardProps

Props accepted by the AchievementCard component.

interface AchievementCardProps {
  /** Achievement name. */
  name: JSX.Element
  /** Description / what it took to earn. */
  description?: JSX.Element
  /** Icon / illustration slot. */
  icon: JSX.Element
  /** Whether the user has earned this achievement. */
  earned?: boolean
  /** Earned-at display. */
  earnedAt?: JSX.Element
  /**
   * Label shown before `earnedAt` on earned achievements. Overrides the
   * translated / `defaultValue` `'Earned'` (prop > `t()` > default).
   */
  earnedLabel?: string
  /**
   * Label shown on locked achievements (not earned, no progress). Overrides
   * the translated / `defaultValue` `'Locked'` (prop > `t()` > default).
   */
  lockedLabel?: string
  /** Optional progress data (for in-progress achievements): the earned count out of a maximum. */
  progress?: { value: number; max: number }
  /** Optional rarity / tier label ("Legendary", "Common"). */
  tier?: JSX.Element
  /** Extra classes. */
  className?: string
}

Functions

AchievementCard(props)

Badge / achievement unlock card — icon + name + description + earned state. Locked achievements render greyed-out.

This is the Solid counterpart of @molecule/app-achievement-card-react: the same props (React names), the same ClassMap tokens and the same DOM for the same input.

function AchievementCard(props: AchievementCardProps): JSX.Element
  • props — Component props (see AchievementCardProps).

Returns: The rendered achievement card.

Injection Notes

Requirements

Peer dependencies:

  • @molecule/app-i18n ^1.0.1
  • @molecule/app-solid ^3.14.0 || ^4.0.0
  • @molecule/app-ui ^1.0.1
  • @molecule/app-ui-solid ^1.1.0
  • solid-js ^1.8.0

Runtime Dependencies

  • @molecule/app-i18n
  • @molecule/app-solid
  • @molecule/app-ui
  • @molecule/app-ui-solid
  • solid-js

The "Earned"/"Locked" state labels flow through t() with English defaultValue fallbacks under the achievementCard.* keys, so the @molecule/app-locales-achievement-card companion bond (or the host app's own locale) can translate them. Each is also overridable per-instance via the earnedLabel / lockedLabel props (prop > t() > default). The labels are read through useTranslation(), so they follow a locale switch.

Translations

Translation strings are provided by @molecule/app-locales-achievement-card.