@molecule/app-status-badge-svelte
Feature · status-badge · App (browser) · v1.1.3 · Apache-2.0
Svelte status badge / pill with semantic kinds
npm install @molecule/app-status-badge-svelteHow it works
@molecule/app-status-badge-svelte is a ready-made status-badge feature for the app (browser) side. It composes the core interfaces it needs, so it works with whichever providers your app has bonded.
<script lang="ts">
import { StatusBadge, StatusPill } from '@molecule/app-status-badge-svelte'
</script>
<StatusBadge kind="success">Open</StatusBadge>
<StatusBadge kind="warning">
{#snippet icon()}<span aria-hidden="true">!</span>{/snippet}
Pending
</StatusBadge>
<StatusPill kind="error">Overdue</StatusPill>Works with: @molecule/app-svelte, @molecule/app-ui, @molecule/app-ui-svelte
Reference
Svelte status-badge and status-pill components.
Both components map a small StatusKind union (success/warning/
error/info/neutral) to ClassMap-driven styling so apps can
restyle by swapping the ClassMap bond rather than rewriting
components.
<StatusBadge kind children icon? appearance? className?> — the
contract is kind + children (there are NO label/color props).
appearance='ui' (default) wraps the framework <Badge> from
@molecule/app-ui-svelte and works with any ClassMap bond.
<StatusPill kind children dot? className?> adds a small colored
status dot before the label.
This is the Svelte counterpart of @molecule/app-status-badge-react: the
same props (React names), the same ClassMap tokens, and the same DOM for the
same input. Node-valued props (children, icon) are snippets.
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.tsJSDoc, not this file.
Quick Start
<script lang="ts">
import { StatusBadge, StatusPill } from '@molecule/app-status-badge-svelte'
</script>
<StatusBadge kind="success">Open</StatusBadge>
<StatusBadge kind="warning">
{#snippet icon()}<span aria-hidden="true">!</span>{/snippet}
Pending
</StatusBadge>
<StatusPill kind="error">Overdue</StatusPill>
Type
feature
Installation
npm install @molecule/app-status-badge-svelte @molecule/app-svelte @molecule/app-ui @molecule/app-ui-svelte svelte
API
Interfaces
StatusBadgeProps
Props for the StatusBadge component.
interface StatusBadgeProps {
/** Semantic kind — maps to ClassMap badge color variants. */
kind?: StatusKind
/** Badge label (usually `t('...')`). */
children: Snippet
/** Optional leading icon (e.g. a dot or check). */
icon?: Snippet
/**
* Visual appearance variant.
* - `'ui'` (default) — wraps the framework `<Badge>` with ClassMap-driven
* coloring. Honors the active ClassMap bond's badge styling and works
* with any theme.
* - `'uppercase-pill'` — a compact uppercase pill that colors itself with
* the SAME ClassMap `badge` tokens as the `'ui'` variant, then layers
* `cm.uppercase` + `cm.trackingWide` for the uppercase treatment.
*/
appearance?: 'ui' | 'uppercase-pill'
/** Extra classes passed through to the rendered element. */
className?: string
}
StatusPillProps
Props for the StatusPill component.
interface StatusPillProps {
/** Semantic kind. */
kind?: StatusKind
/** Pill label. */
children: Snippet
/** Render a leading dot indicator. Defaults to true. */
dot?: boolean
/** Extra classes. */
className?: string
}
Types
StatusKind
Semantic status kind used to select badge color variants.
type StatusKind = 'success' | 'warning' | 'error' | 'info' | 'neutral'
Constants
StatusBadge
const StatusBadge: LegacyComponentType
StatusPill
const StatusPill: LegacyComponentType
Injection Notes
Requirements
Peer dependencies:
@molecule/app-svelte^3.13.0 || ^4.0.0@molecule/app-ui^1.0.1@molecule/app-ui-svelte^1.1.0svelte^5.0.0
Runtime Dependencies
-
@molecule/app-svelte -
@molecule/app-ui -
@molecule/app-ui-svelte -
svelte -
Requires a wired ClassMap bond (e.g.
@molecule/app-ui-tailwind) —getClassMap()throws before bonding. -
Both
appearancevariants color through the ClassMapbadgetokens (cm.badge({ variant })→ realbg-*/text-*theme utilities), so the'uppercase-pill'variant is visibly colored per kind in every theme — it just addscm.uppercase+cm.trackingWideon top of the same colors the'ui'variant uses. -
<StatusPill>has no background surface of its own — only the dot is colored; add a surface viaclassNameif you need a filled pill. Itsneutraldot usesbg-outline, which also needs a themeoutlinecolor token to be visible. -
Labels are
children— pass already-translated strings (t('...')); the components render no text of their own.