Mixins / foldkit-mixins-ui

ButtonView

interface · packages/mixins-ui/src/button.ts:48

interface ButtonView<Message> {
  readonly label: string
  readonly style?: NamedStyle<typeof ButtonSlots> | undefined
  readonly mixins?: MixinList<Message> | undefined
  readonly input?: unknown
  readonly type?: 'button' | 'submit' | 'reset' | undefined
  readonly disabled?: boolean | undefined
  readonly onClick?: Message | undefined
  readonly pressed?: boolean | undefined
}

A button in one call: the label, a style for its slot, and the rest of @foldkit/ui's own config. toView stays for a button drawn as something else (an a, a split control); this covers the common case.

Members

ButtonView.label

property · packages/mixins-ui/src/button.ts:50

readonly label: string

The button's text.

ButtonView.style

property · packages/mixins-ui/src/button.ts:52

readonly style?: NamedStyle<typeof ButtonSlots> | undefined

A style of ButtonSlots, for the button's own look.

ButtonView.mixins

property · packages/mixins-ui/src/button.ts:54

readonly mixins?: MixinList<Message> | undefined

Mixins beside the style, for state or behavior the style does not own.

ButtonView.input

property · packages/mixins-ui/src/button.ts:56

readonly input?: unknown

What an input-driven Mixin reads; omit it when no attached Mixin reads one.

ButtonView.type

property · packages/mixins-ui/src/button.ts:57

readonly type?: 'button' | 'submit' | 'reset' | undefined

ButtonView.disabled

property · packages/mixins-ui/src/button.ts:58

readonly disabled?: boolean | undefined

ButtonView.onClick

property · packages/mixins-ui/src/button.ts:59

readonly onClick?: Message | undefined

ButtonView.pressed

property · packages/mixins-ui/src/button.ts:64

readonly pressed?: boolean | undefined

Whether the button is on, as a toggle button: aria-pressed, and the recipe's pressed look. Omit it for a button that is not a toggle.