Skip to content

add automatic "loading" state for Vue Button component #1397

@dadaxr

Description

@dadaxr

The new Statamic "Button" component ( https://ui.statamic.dev/?path=/docs/forms-button--docs ) has a "loading" attribute to disable it state (& prevent clicking).

It seems this Button component is a supercharged inertia Link component... So we can use all props available on Inertia Links like the "method" and "href" (to do directly some Post Request) .

Inertia Link component is auto setting a "data-loading" attribute (https://inertiajs.com/docs/v2/the-basics/links#data-loading-attribute) , but for now, it's unrelated to the "loading" prop of the Statamic Button component ...

It would be great to have another props on the Button Component (like "auto-loading-state" : true / false) which would automatically handle that binding for us...

For now we have to manually set the loading prop to true/false using the inertia manual router visit & "onBefore" and "onFinish" callbacks (https://inertiajs.com/docs/v1/the-basics/manual-visits#event-callbacks)

What do you think ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions