Skip to content

Document declarative conventions and ensure alignment in existing components #246

@LeaVerou

Description

@LeaVerou

There are several components that support declarative commands, which we currently do ad hoc with data- attributes:

While we can't yet use the invoker API, it may be a good idea to use invoker-compatible syntax like command="--toggle-nav" so that we could seamlessly switch to it later. It costs us nothing and makes WA look forward-facing to those in the know (who are few, but tend to be influential). That said, I hate it that they went with the -- convention because it looks ugly AF. But that ship has sailed, and this syntax is where we're heading towards, so it could be argued that we may as well be the first to use it…

An alternative path could be to use our own command attribute, e.g. wa-command="toggle-nav" or wa-action="toggle-nav".

E.g. (if we go with data-wa-, which is a separate issue)

<button data-wa-action="toggle-nav">
<button data-wa-action="close-dialog">

WRT opening dialogs, idea by @claviska:

<button data-wa-action="open-dialog id">

<!-- OR, to use a selector -->
<button data-wa-action="open-dialog" data-wa-action-target="& + dialog">

Alternatively:

<button data-wa-action="open-dialog #id">

<!-- OR, to use a selector -->
<button data-wa-action="open-dialog & + dialog">

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentation

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions