Mixins / foldkit-mixins-ui

Choice

interface · packages/mixins-ui/src/choice.ts:26

interface Choice<Item extends string, Value> {
  readonly items: ReadonlyArray<Item>
  readonly empty: Value
  readonly picked: (value: Value, change: ChoiceChange) => Value
  readonly chosen: (value: Value) => ReadonlyArray<Item>
  readonly resting: (value: Value, labelOf: (item: Item) => string) => string
  readonly multiple: boolean
}

Members

Choice.items

property · packages/mixins-ui/src/choice.ts:28

readonly items: ReadonlyArray<Item>

Every item that can be chosen. A reported value is looked up here, so what is stored is an Item.

Choice.empty

property · packages/mixins-ui/src/choice.ts:30

readonly empty: Value

The value with nothing chosen.

Choice.picked

property · packages/mixins-ui/src/choice.ts:32

readonly picked: (value: Value, change: ChoiceChange) => Value

The value after change; the same value when the change does not move it.

Choice.chosen

property · packages/mixins-ui/src/choice.ts:34

readonly chosen: (value: Value) => ReadonlyArray<Item>

The chosen items, for the view to mark.

Choice.resting

property · packages/mixins-ui/src/choice.ts:36

readonly resting: (value: Value, labelOf: (item: Item) => string) => string

What a closed input rests on.

Choice.multiple

property · packages/mixins-ui/src/choice.ts:38

readonly multiple: boolean

Whether several items may be chosen, which the list says to assistive technology.