Mixins / foldkit-mixins-ui

ButtonView

type · packages/mixins-ui/src/button.ts:131

type ButtonView<Message> = ButtonCommon<Message> &
  (
    | {
        readonly type?: 'button' | 'submit' | 'reset' | undefined
        readonly onClick?: NoInfer<Message> | undefined
        readonly href?: undefined
        readonly external?: undefined
      }
    | {
        readonly href: string
        readonly external?: boolean | undefined
        readonly type?: undefined
        readonly onClick?: undefined
      }
  )

A button in one call: the label, a style for its slot, and the rest of @foldkit/ui's own config. It presses (onClick, type) or it is a link (href, external), never both; toView stays for a control drawn as something else (a split control).