Skip to content

dvlopcore toolkit

Button

One action: a link for an address, a button for an action or a submit. The caller says what is asked; the component decides the element.

Demo

Property editor

Change a value and apply it; the demo renders with the new values. A refused value is reported at its field and the demo keeps the starting value.

The visible text; it is the accessible name.

The weight of the action, by meaning: primary for the main actions (the menu, the chips), secondary for a link in a list.

Where it goes; renders an <a>. Without it the element is a <button>.

The name of what the button does, on data-action for a script.

True inside a form: type="submit"; else type="button".

aria-current when this is the current item: page for the current page, true for the current choice.

One short sentence read after the name (aria-describedby to a sibling span); needs id.

The reason the action cannot be taken now: aria-disabled, the reason as its description; needs id.

Reset

The demo shows its starting values.

Properties

PropertyTypeDefaultAllowed valuesDescription
labelstringrequiredThe visible text; it is the accessible name.
variantstringsecondaryprimary, secondary, accent, success, dangerThe weight of the action, by meaning: primary for the main actions (the menu, the chips), secondary for a link in a list.
hrefstringnoneWhere it goes; renders an <a>. Without it the element is a <button>.
actionstringnoneThe name of what the button does, on data-action for a script.
submitboolfalseTrue inside a form: type="submit"; else type="button".
fieldstringnoneThe name a submit button sends.
valuestringnoneThe value a submit button sends.
currentstringnonepage, truearia-current when this is the current item: page for the current page, true for the current choice.
descriptionstringnoneOne short sentence read after the name (aria-describedby to a sibling span); needs id.
unavailablestringnoneThe reason the action cannot be taken now: aria-disabled, the reason as its description; needs id.
idstringnoneThe element's id; required with description or unavailable.
srBeforestringnoneWords for screen readers only, a sibling span before the label.
srAfterstringnoneWords for screen readers only, a sibling span after the label.
langstringnoneThe language of the label when it differs from the page's.
hreflangstringnoneThe language of the target of an href.
namestringnoneThe accessible name when the label is a code ("EN" named "English"): aria-label, only when the label cannot be the name itself.
classesarraynoneThe using component's own part class(es), such as dv-navbar-item.
attributesarraynoneExtra attributes [name => value], escaped (rel, download, ...).

Events

This component sends no events.

Keyboard

KeysDoes
Enter, SpaceActivates a button; Enter follows a link. Native, no script.

Accessibility

Rationale

The markup of an action is written in one place, with its style and its test, so a navbar item, a disclosure chip and a form's submit cannot drift apart (COMMON-148). Variants are named by meaning, never by colour, as the UI kit's action variants are. The state is an attribute (aria-current, aria-disabled), so what a screen reader says and what the stylesheet draws are the same truth.

References

Uses

This component uses no other component.

Used by

README

button

One action: a link (href) or a button (action, or submit inside a form). The caller says what is asked; the component decides the element and the attributes. Used by the navbar (its items), the disclosure (its chip and its links) and any hook of a site.

  • Variants: primary (the site's main action colours: the menu, the chips), secondary (a surface with a border: the links in a list), accent, success, danger. Never a colour name.
  • Keyboard: native. State by attribute: aria-current, aria-disabled, aria-describedby.
  • Every part has a touch target of --touch-target and the focus tokens on every background.

Change log

  • 2026-10-14: component.json (the manifest: the props now live there) and demo.php (the demos the inspector and the catalogue page show) added; see docs/architecture/inspector.md.
  • 2026-10-14: new, from the navbar's items, the disclosure chip and the share links of header.php and base.css.