@molecule/app-notification-badge-solid
Feature · notification-badge · App (browser) · v1.1.1 · Apache-2.0
Unread count badge and positioned wrapper for attaching to any child
npm install @molecule/app-notification-badge-solidHow it works
@molecule/app-notification-badge-solid is a ready-made notification-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 { NotificationBadge, NotificationDot, NotificationWrapper } from '@molecule/app-notification-badge-solid'
<NotificationBadge count={5} variant="error" />
<NotificationDot visible variant="info" position="corner" />
<NotificationWrapper count={12} placement="top-right">
<span aria-hidden>notifications</span>
</NotificationWrapper>Works with: @molecule/app-solid, @molecule/app-ui, @molecule/app-ui-solid
Reference
Solid notification badge / dot / wrapper.
Exports:
<NotificationBadge>— count pill withmax+overflow handling.<NotificationDot>— tiny presence indicator.<NotificationWrapper>— positions a badge at the corner of any child.
It is the Solid counterpart of @molecule/app-notification-badge-react:
same props (React names) and the same DOM for the same input, so an app
can switch framework by changing only the package name in its imports.
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 { NotificationBadge, NotificationDot, NotificationWrapper } from '@molecule/app-notification-badge-solid'
<NotificationBadge count={5} variant="error" />
<NotificationDot visible variant="info" position="corner" />
<NotificationWrapper count={12} placement="top-right">
<span aria-hidden>notifications</span>
</NotificationWrapper>
Type
feature
Installation
npm install @molecule/app-notification-badge-solid @molecule/app-solid @molecule/app-ui @molecule/app-ui-solid solid-js
API
Interfaces
NotificationBadgeProps
Props accepted by the NotificationBadge component.
interface NotificationBadgeProps {
/** Numeric count — renders as a pill. When 0 and `hideOnZero` is true, the badge isn't rendered. */
count: number
/** Hide the badge when `count` is 0. Defaults to true. */
hideOnZero?: boolean
/** When `count > max`, renders as `max+`. Defaults to 99. */
max?: number
/** Accent color. */
variant?: 'error' | 'warning' | 'info' | 'success' | 'neutral'
/** Extra classes. */
className?: string
}
NotificationDotProps
Props accepted by the NotificationDot component.
interface NotificationDotProps {
/** When false, nothing is rendered. */
visible?: boolean
/** Color variant. */
variant?: 'error' | 'warning' | 'info' | 'success' | 'neutral'
/** Dot size (pixels). Defaults to 8. */
size?: number
/** Optional positioning — `'corner'` places absolutely at top-right of parent. */
position?: 'inline' | 'corner'
/** Extra classes. */
className?: string
}
NotificationWrapperProps
Props accepted by the NotificationWrapper component.
interface NotificationWrapperProps {
/** The child that should receive the badge (icon button, avatar, nav item). */
children: JSX.Element
/** Notification count. */
count: number
/** Hide the badge when count is 0. Defaults to true. */
hideOnZero?: boolean
/** Visual variant. */
variant?: 'error' | 'warning' | 'info' | 'success' | 'neutral'
/** Corner placement. Defaults to `'top-right'`. */
placement?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left'
/** Extra classes. */
className?: string
}
Functions
NotificationBadge(props)
Small count pill — typically attached to a nav item, icon button, or
inbox entry. Use <NotificationDot> when you just need a presence
indicator without a count.
function NotificationBadge(props: NotificationBadgeProps): JSX.Element
props— Component props (seeNotificationBadgeProps).
Returns: The rendered badge, or nothing while hidden.
NotificationDot(props)
Tiny unread / presence indicator. For counted badges use
<NotificationBadge>.
function NotificationDot(props: NotificationDotProps): JSX.Element
props— Component props (seeNotificationDotProps).
Returns: The rendered dot, or nothing when visible is false.
NotificationWrapper(props)
Positions a <NotificationBadge> at a corner of any child element.
The wrapper becomes relative so the badge absolutely positions
correctly — wrap icon buttons, avatars, or nav entries.
function NotificationWrapper(props: NotificationWrapperProps): JSX.Element
props— Component props (seeNotificationWrapperProps).
Returns: The rendered wrapper.
Injection Notes
Requirements
Peer dependencies:
@molecule/app-solid^3.5.0 || ^4.0.0@molecule/app-ui^1.0.1@molecule/app-ui-solid^1.1.0solid-js^1.8.0
Runtime Dependencies
@molecule/app-solid@molecule/app-ui@molecule/app-ui-solidsolid-js
Requires a wired ClassMap bond — getClassMap() throws before wiring.
Every variant resolves to a real theme background token, so all five are
visible in both light and dark themes: error / warning / info /
success map to the semantic status colors, and neutral maps to the
surface-secondary surface token (what cm.surfaceSecondary emits) for a
neutral grey fill.
<NotificationWrapper> absolutely positions the badge 4px OUTSIDE the
child's corner — an overflow: hidden ancestor will clip it.