@molecule/app-status-badge-vue
Feature · status-badge · App (browser) · v1.1.2 · Apache-2.0
Vue status badge / pill with semantic kinds
npm install @molecule/app-status-badge-vueHow it works
@molecule/app-status-badge-vue 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.
import { defineComponent, h } from 'vue'
import { StatusBadge, StatusPill } from '@molecule/app-status-badge-vue'
const Row = defineComponent({
setup() {
return () =>
h('div', [
h(StatusBadge, { kind: 'success' }, () => ['Open']),
h(
StatusBadge,
{ kind: 'warning' },
{
default: () => ['Pending'],
icon: () => [h('span', { 'aria-hidden': 'true' }, '!')],
},
),
h(StatusPill, { kind: 'error' }, () => ['Overdue']),
])
},
})Works with: @molecule/app-ui, @molecule/app-ui-vue, @molecule/app-vue
Reference
Vue 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-vue and works with any ClassMap bond.
<StatusPill kind children dot? className?> adds a small colored
status dot before the label.
This is the Vue 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 slots, or props of the same
names.
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
import { defineComponent, h } from 'vue'
import { StatusBadge, StatusPill } from '@molecule/app-status-badge-vue'
const Row = defineComponent({
setup() {
return () =>
h('div', [
h(StatusBadge, { kind: 'success' }, () => ['Open']),
h(
StatusBadge,
{ kind: 'warning' },
{
default: () => ['Pending'],
icon: () => [h('span', { 'aria-hidden': 'true' }, '!')],
},
),
h(StatusPill, { kind: 'error' }, () => ['Overdue']),
])
},
})
Type
feature
Installation
npm install @molecule/app-status-badge-vue @molecule/app-ui @molecule/app-ui-vue @molecule/app-vue vue
API
Interfaces
StatusBadgeProps
Props for the StatusBadge component.
interface StatusBadgeProps {
/** Semantic kind — maps to ClassMap badge color variants. */
kind?: StatusKind
/** Badge label (usually `t('...')`) — the default slot, or a prop. */
children?: VNodeChild
/** Optional leading icon — the `icon` slot, or a prop. */
icon?: VNodeChild
/**
* 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 — the default slot, or a prop. */
children?: VNodeChild
/** 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
Semantic status badge — maps status kinds to ClassMap color variants.
Both appearances resolve their color through the ClassMap badge tokens,
so they stay theme-correct: appearance="ui" (default) renders the
framework <Badge>, and 'uppercase-pill' renders a compact uppercase pill
with the same per-kind bg-* / text-* colors.
const StatusBadge: DefineComponent<
ExtractPropTypes<{
kind: { type: PropType<StatusKind>; default: string }
children: null
icon: null
appearance: { type: PropType<'ui' | 'uppercase-pill'>; default: string }
className: StringConstructor
}>,
() => VNode,
{},
{},
{},
ComponentOptionsMixin,
ComponentOptionsMixin,
{},
string,
PublicProps,
Readonly<
ExtractPropTypes<{
kind: { type: PropType<StatusKind>; default: string }
children: null
icon: null
appearance: { type: PropType<'ui' | 'uppercase-pill'>; default: string }
className: StringConstructor
}>
> &
Readonly<{}>,
{ kind: StatusKind; appearance: 'ui' | 'uppercase-pill' },
{},
{},
{},
string,
ComponentProvideOptions,
true,
{},
any
>
props— Component props (seeStatusBadgeProps).
Returns: The status badge component.
StatusPill
Rounded status pill with an optional leading colored dot. The pill has NO
background surface of its own — only the dot carries color — so add a
surface via className if you need a filled pill.
const StatusPill: DefineComponent<
ExtractPropTypes<{
kind: { type: PropType<StatusKind>; default: string }
children: null
dot: { type: BooleanConstructor; default: boolean }
className: StringConstructor
}>,
() => VNode,
{},
{},
{},
ComponentOptionsMixin,
ComponentOptionsMixin,
{},
string,
PublicProps,
Readonly<
ExtractPropTypes<{
kind: { type: PropType<StatusKind>; default: string }
children: null
dot: { type: BooleanConstructor; default: boolean }
className: StringConstructor
}>
> &
Readonly<{}>,
{ kind: StatusKind; dot: boolean },
{},
{},
{},
string,
ComponentProvideOptions,
true,
{},
any
>
props— Component props (seeStatusPillProps).
Returns: The status pill component.
Injection Notes
Requirements
Peer dependencies:
@molecule/app-ui^1.0.1@molecule/app-ui-vue^1.1.0@molecule/app-vue^3.13.0 || ^4.0.0vue^3.4.0
Runtime Dependencies
-
@molecule/app-ui -
@molecule/app-ui-vue -
@molecule/app-vue -
vue -
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.