Skip to main content

Action Button Ready

The action button is used internally in duet-pagination, duet-date-picker and duet-editable-table

The action button should be used to signify small round buttons that can be clicked to invoke UI actions

Examples #

Open in new window
<duet-layout center>
<div slot="main">
<duet-card heading="Default action button">
<duet-action-button></duet-action-button>

</duet-card>
</div>
</duet-layout>
<script>
const actionBN = document.querySelector('duet-action-button');


actionBN.addEventListener('duetActionEvent', (e) => {
console.log(e.detail);
});


</script>
Open in new window
<duet-layout center>
<div slot="main">
<duet-card heading="Coloured action buttons with callback features">
<duet-action-button
action-name="go-back"
action-meta="{some:'string'}"
action-id="foobar2000"
>
</duet-action-button>
<duet-action-button disabled></duet-action-button>
<duet-divider></duet-divider>
<duet-action-button background="danger" name="category-personal" color="gray-lightest"></duet-action-button>
<duet-action-button
disabled
background="danger"
name="category-personal"
color="gray-lightest"
>
</duet-action-button>

</duet-card>
</div>
</duet-layout>
<script>
const actionBN = document.querySelectorAll('duet-action-button');


actionBN.forEach(item=>{
item.addEventListener('duetActionEvent', (e) => {
console.log(e.detail);
});
})


</script>

Properties #

Property Attribute Description Type Default
accessibleControls accessible-controls Used to indicate which dom element with ID this element controls string ""
accessibleDescribedBy accessible-described-by Described By id string undefined
accessibleDescription accessible-description Aria description the button string undefined
accessibleDetails accessible-details Details of the component string undefined
accessibleLabel accessible-label Accessible label string getLocaleString( this.accessibleLabelsDefaults )
accessibleLabelledBy accessible-labelled-by String of id's that indicate alternative labels elements string undefined
accessibleLabelsDefaults -- Default accessible label DuetLangObject { en: "Click to activate action", fi: "Klikkaa aktivoidaksesi toiminto", sv: "Klicka för att aktivera åtgärd", }
accessibleTitle title Title of the action button (shows as DOM tooltip when hovering) if set to true, this will try to add a best-guess title based on action-name if set to a string the string is used if set to false nothing is set boolean | string true
actionId action-id Name of id of action that was called being called string undefined
actionMeta action-meta Name of id of action that was called being called string | { [x: string]: any; } undefined
actionName action-name Name of action being called string undefined
background background Custom color to be used for a background, as a design token entered in camelCase or kebab-case. Using this option the icon will always be resized to $size-icon-medium on mobile viewports. Example: "color-primary". string ""
color color Custom color to be used for the icon, as a design token entered in camelCase or kebab-case. Example: "color-primary". This property can also be set to "currentColor" which forces the icon to use the CSS text color of parent element instead. Useful when you want to control the color in stylesheet instead. string ""
disabled disabled Disables the button boolean false
iconColor icon-color Color of the icon to display string "currentColor"
iconName icon-name Name of the icon to display string "action-arrow-left-small"
iconSize icon-size Size of the icon "small" | "x-small" | "xx-small" "xx-small"
theme theme Theme of the pagination. "" | "default" | "turva" ""
url url A destination to link to, rendered in the href attribute of a link. string undefined

Events #

Event Description Type
duetActionEvent Emitted when an action has been invoked CustomEvent<{ originalEvent?: Event; component: "duet-action-button"; action: string; name?: string; id?: string; index?: string; meta?: string | Record<any, any>; }>

Methods #

setFocus(options?: FocusOptions) => Promise<void> #

Sets focus on the specified duet-action-button. Use this method instead of the global
button.focus().

Parameters #

Name Type Description
options FocusOptions

Returns #

Type: Promise<void>

Slots #

Slot Description
"default" slot inside an invisible element, this can be used to enhance accessibility

Shadow Parts #

Part Description
"button" this part enables style overrides for the button
"icon" this part enables style overrides for the icon

Usage #

This section includes guidelines for designers and developers about the usage of this component in different contexts.

When to use #

  • To give a user a button to click, in order to perform an action, this button is always round, and always inconspicuous - if you need larger buttons use the duet-button instead

When not to use #

  • For navigation purposes

Accessibility #

This component has been validated to meet the WCAG 2.1 AA accessibility guidelines. You can find additional information regarding accessibility of this component below.


Integration

For integration, event and theming guidelines, please see Using Components. This documentation explains how to implement and use Duet’s components across different technologies like Angular, React or Vanilla JavaScript.

Integration guidelines


Tutorials

Follow these practical tutorials to learn how to build simple page layouts using Duet’s CSS Framework, Web Components and other features:

Tutorials

Building Layouts

Tutorials

Using CLI Tools

Tutorials

Creating Custom Patterns

Tutorials

Server Side Rendering

Tutorials

Sharing Prototypes

Tutorials

Usage With Markdown


Troubleshooting

If you experience any issues while using a component, please head over to the Support page for more guidelines and help.