Mixins / foldkit-mixins-ui

Checkbox

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

export * as Checkbox from './checkbox.js'

In the guides

Members

Checkbox.CheckboxPreset

type · packages/mixins-ui/src/checkbox/view.ts:105

type CheckboxPreset = Pick<CheckboxView<never>, 'position' | 'style'> & {
  readonly mixins?: MixinList<never>
}

What a Checkbox is given once: its look and each option that holds no Message and nothing of one field.

Checkbox.CheckboxSlots

const · packages/mixins-ui/src/checkbox/slots.ts:11

const CheckboxSlots: Slots.Contract<{ readonly checkbox: Slot.UnnamedSlot<Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>, readonly [Event.EventToken<"click">], readonly [Attr.AttrToken<"role">, Attr.AttrToken<"aria-checked">, Attr.AttrToken<"aria-labelledby">, Attr.AttrToken<"aria-disabled">, Attr.AttrToken<"aria-invalid">, Attr.AttrToken<"disabled">, Attr.AttrToken<"value">], readonly Slot.RequirementName[], boolean>; readonly label: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly [Event.EventToken<"click">], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>; readonly description: 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 hiddenInput: Slot.UnnamedSlot<Capability.Capability<"Base", readonly []>, readonly Slot.EventName[], readonly [Attr.AttrToken<"value">], readonly Slot.RequirementName[], boolean>; readonly root: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly [], readonly [], readonly [], false>; readonly text: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Cap …;

Both the control and its label carry the base toggle handlers, so both own click. hiddenInput exists only when a form name is configured; its base bundle is then empty. root, text, heading and aside lay out the row Checkbox.view draws; an application drawing its own through toView need not use them.

Checkbox.CheckboxView

interface · packages/mixins-ui/src/checkbox/view.ts:17

interface CheckboxView<Outer> {
  readonly id: string
  readonly checked: boolean
  readonly onToggle: (checked: boolean) => NoInfer<Outer>
  readonly label: string
  readonly description?: string | undefined
  readonly position?: TogglePosition | undefined
  readonly labelAside?: Html | undefined
  readonly indeterminate?: boolean | undefined
  readonly disabled?: boolean | undefined
  readonly readOnly?: boolean | undefined
  readonly invalid?: boolean | undefined
  readonly name?: string | undefined
  readonly value?: string | undefined
  readonly style?: NamedStyle<typeof CheckboxSlots> | undefined
  readonly mixins?: MixinList<Outer> | undefined
}

Checkbox.configure

function · packages/mixins-ui/src/checkbox/view.ts:114

function configure<const Names extends string = never>(
  config: Presets<CheckboxPreset, Names>,
): {
  readonly view: <Outer>(
    options: CheckboxView<Outer> & PresetOption<Names>,
    h: HtmlBuilder<Outer>,
  ) => Html
}

The application's own Checkbox: base for every use, presets chosen at a use with preset, and the call over both. mixins concatenate in that order; any other option given at the call replaces the preset's.

Checkbox.resolve

function · packages/mixins-ui/src/checkbox.ts:17

function resolve<Input, Message>(
  attributes: CheckboxAttributes<Message>,
  mixins: MixinList<Message>,
  context: ResolveContext<Input, Message>,
): ResolvedCheckbox<Message>

Applies mixins to the checkbox's bundles.

Checkbox.ResolvedCheckbox

type · packages/mixins-ui/src/checkbox.ts:10

type ResolvedCheckbox<Message> = Resolved<
  CheckboxAttributes<Message>,
  typeof CheckboxSlots,
  Message
>

The checkbox's bundles with the attached Mixins applied.

Checkbox.toView

function · packages/mixins-ui/src/checkbox.ts:24

function toView<Message>(
  mixins: MixinList<Message>,
  context: ResolveContext<unknown, Message>,
  draw: (resolved: ResolvedCheckbox<Message>) => Html,
): (attributes: CheckboxAttributes<Message>) => Html

The checkbox's toView: draw receives its bundles with mixins applied.

Checkbox.view

function · packages/mixins-ui/src/checkbox/view.ts:47

function view<Outer>(options: CheckboxView<Outer>, h: HtmlBuilder<Outer>): Html