Mixins / foldkit-mixins-ui

Steps

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

export * as Steps from './steps.js'

In the guides

Members

Steps.configure

function · packages/mixins-ui/src/steps.ts:178

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

The application's own Steps: base for every use, presets chosen at a use with preset, and the call over both.

Steps.Step

interface · packages/mixins-ui/src/steps.ts:47

interface Step {
  readonly title: string
  readonly state?: StepsState | undefined
  readonly trailing?: Html | undefined
  readonly description?: string | undefined
  readonly icon?: Html | undefined
  readonly content?: Html | undefined
}

Steps.StepsPreset

type · packages/mixins-ui/src/steps.ts:170

type StepsPreset = Pick<StepsView<never>, 'style' | 'words'> & {
  readonly mixins?: MixinList<never>
}

What a Steps list is given once: its look and its words.

Steps.StepsSlots

const · packages/mixins-ui/src/steps.ts:25

const StepsSlots: Slots.Contract<{ readonly root: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly Slot.EventName[], readonly [Attr.AttrToken<"aria-label">], readonly Slot.RequirementName[], boolean>; readonly item: 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 step: 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 trigger: Slot.UnnamedSlot<Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>, readonly [Event.EventToken<"click">], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>; readonly marker: 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 number: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Ca …;

A stepper, Zag's steps and Mantine's Stepper: a named ordered list of steps, each a numbered marker with a title and a description, a connector between each and the next. The current step is the application's: it is aria-current="step", those before it complete (a check in place of the number) and those after upcoming, as data-state on the item, marker, title and connector. A current past the last step completes them all. Given onSelect, a completed step is a button that goes back to it; a step ahead never is, since reaching it is the form's job, not the list's. A step's icon stands in the marker for its number, and its content follows it in the item, beside the connector in a vertical stepper. A step's state overrides the derived one (loading, error, or a later step already complete), its aria-current staying by position, and its trailing Html ends its row. progress, how far the current step has gone, is the root's --fk-steps-progress, which the recipe's connector: 'progress' fills the current step's connector by.

Steps.StepsState

type · packages/mixins-ui/src/steps.ts:45

type StepsState = 'complete' | 'current' | 'upcoming' | 'loading' | 'error'

Where a step stands: derived from current, or stated by the step.

Steps.StepsView

interface · packages/mixins-ui/src/steps.ts:86

interface StepsView<Message> {
  readonly label: string
  readonly steps: ReadonlyArray<Step>
  readonly current: number
  readonly onSelect?: ((index: number) => NoInfer<Message>) | undefined
  readonly progress?: number | undefined
  readonly words?: Partial<StepsWords> | undefined
  readonly style?: NamedStyle<typeof StepsSlots> | undefined
  readonly mixins?: MixinList<Message> | undefined
}

Steps.StepsWords

interface · packages/mixins-ui/src/steps.ts:68

interface StepsWords {
  readonly complete: string
  readonly current: string
  readonly upcoming: string
  readonly loading: string
  readonly error: string
}

What each state of a step says to a screen reader, after its title; an empty word says nothing.

Steps.view

function · packages/mixins-ui/src/steps.ts:108

function view<Message>(
  options: StepsView<Message>,
  h: HtmlBuilder<Message>,
): Html

Steps.words

const · packages/mixins-ui/src/steps.ts:78

const words = { complete, current, upcoming, loading, error }

The defaults, in English.