Mixins / foldkit-mixins-ui

Icon

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

export * as Icon from './icon.js'

In the guides

Members

Icon.IconSlots

const · packages/mixins-ui/src/icon.ts:12

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

An icon publishes the box it stands in and a mark on its corner; it owns no state, messages, or bundles. A label makes it an image. Without one it is decorative and hidden from the accessibility tree. Icons.glyph is the other tool: a mask on an element that already exists.

Icon.IconView

type · packages/mixins-ui/src/icon.ts:37

type IconView<Message = never> = IconCommon<Message> &
  (
    | {
        readonly icon: IconData
        readonly key?: string | undefined
        readonly glyph?: undefined
      }
    | {
        readonly glyph: Html
        readonly icon?: undefined
        readonly key?: undefined
      }
  )

An icon in one call: the icon it draws or a drawing of your own (initials, a count, an emoji), the name it has when it means something, a style for its slots, and mixins beside the style.

Icon.view

function · packages/mixins-ui/src/icon.ts:54

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