Documentation navigation

Published API · 0.1.0-rc.1

foldkit-ui · button

Published foldkit-ui API declarations for button.

./button

@wsagency/wseffect-foldkit-ui · MIT · source · MIT license · WS-AGENCY-NOTICE · THIRD-PARTY-NOTICES

This entry point is published in @wsagency/wseffect-foldkit-ui@0.1.0-rc.1. Import it from the package subpath shown below; the signatures and documentation are read from the installed package declarations.

import * as Wseffect from '@wsagency/wseffect-foldkit-ui/button'

Exported declarations

ButtonAttributes

Attribute groups the button component provides to the consumer's `toView` callback.

export type ButtonAttributes<Message> = Readonly<{
    button: ReadonlyArray<Attribute<Message>>;
}>;

view

Renders an accessible button by building attribute groups and delegating layout to the consumer's `toView` callback. Takes the consumer's builder, which pins `Message` to the universe of the frame the button is rendered in. `onClick` must come from that same universe, so a Message the consumer's dispatcher cannot route is a compile error here.

view: <Message>(config: ViewConfig<Message>, h: HtmlBuilder<Message>) => Html

ViewConfig

Configuration for rendering a button with `view`.

export type ViewConfig<Message> = Readonly<{
    toView: (attributes: ButtonAttributes<Message>) => Html;
    onClick?: Message;
    isDisabled?: boolean;
    type?: 'button' | 'submit' | 'reset';
    isAutofocus?: boolean;
}>;