Dojo NG is being built in the open, one section at a time — follow along on Heptapod.

API REFERENCE · FORM CONTROLS

<dj-button>

The foundational button.

Try it in the playground

@dojo-ng/button · v0.1.2

npm install @dojo-ng/button

import "@dojo-ng/button";

Properties

PropertyAttributeTypeDefault
disabledWhether the button is disabled. disabled reflected boolean false
kindVisual kind: contained, outlined, or text. kind reflected "contained""outlined""text" "contained"
typeNative button behavior. menu renders as a plain button. type "button""submit""reset""menu" "button"
nameForm field name. name string None
valueForm field value. value string None
labelOptional label set via attribute; the default slot takes precedence. label string None
iconPositionWhere the icon sits relative to the label. icon-position reflected "before""after" "before"
titleNative title (tooltip) text. title string ""
ariaLabelAccessible name, forwarded to the native button inside the shadow root. A custom-element host is not the button in the accessibility tree, so an aria-label left on <dj-button> names nothing. IDREF attributes (aria-labelledby, aria-describedby, aria-controls) are deliberately NOT forwarded: an IDREF inside a shadow root cannot resolve to a light-DOM id, so forwarding one would create a dangling reference that reads as working. aria-label reflected string | null null
ariaPressedToggle state for a button used as a toggle, forwarded alongside the name. aria-pressed reflected string | null null
ariaExpandedDisclosure state for a button that controls a panel, forwarded alongside the name. aria-expanded reflected string | null null

Slots

SlotDescription
Default slotthe button label
iconan icon, placed per icon-position

CSS parts

Style these with dj-button::part(name).

PartDescription
basethe native button
label
icon

CSS custom properties

PropertyDefaultDescription
--dj-button-font-size-smallvar(--dj-font-size-small)Font size of a small button.
--dj-button-font-size-mediumvar(--dj-font-size-medium)Font size of a medium button.
--dj-button-font-size-large1.125remFont size of a large button.

Methods

MethodDescription
focus(options: FocusOptions)Move focus to the underlying native button.
blur()Remove focus from the underlying native button.