Mixins / foldkit-mixins-ui

Badge

namespace · packages/mixins-ui/src/badge.ts:1

export * as Badge from './badge.js'

In the guides

Members

Badge.BadgeSlots

const · packages/mixins-ui/src/badge.ts:10

const BadgeSlots: Slots.Contract<{
  readonly badge: Slot.UnnamedSlot<
    Capability.Capability<
      'Container',
      readonly [
        Capability.Capability<
          'Interactive',
          readonly [Capability.Capability<'Base', readonly []>]
        >,
      ]
    >,
    readonly Slot.EventName[],
    readonly Slot.AttributeName[],
    readonly Slot.RequirementName[],
    boolean
  >
}>

A status pill publishes one slot; it owns no state, messages, or bundles. The pill reads its tone from data-tone, which the Badge recipe maps to a family; values outside the map keep the base.

Badge.BadgeView

interface · packages/mixins-ui/src/badge.ts:19

interface BadgeView<Message = never> {
  readonly text: string
  readonly tone?: string | undefined
  readonly style?: NamedStyle<typeof BadgeSlots> | undefined
  readonly mixins?: MixinList<Message> | undefined
}

A status pill in one call: its words, the tone they carry, a style for its slot, and mixins beside the style. No upstream component stands behind it.

Badge.view

function · packages/mixins-ui/src/badge.ts:29

function view<Message = never>(
  options: BadgeView<Message>,
  h: HtmlBuilder<Message>,
): Html