Add "show label" and "main action" attributes

This commit is contained in:
Adrien Maston
2026-02-25 17:08:11 +01:00
parent 988dc637da
commit 74b91c8832
@@ -1,10 +1,14 @@
import { BridgeElement } from "@hotwired/hotwire-native-bridge"
BridgeElement.prototype.getButton = function() {
return {
const button = {
title: this.title,
icon: this.getIcon()
icon: this.getIcon(),
showLabel: this.getShowLabel(),
isMainAction: this.getIsMainAction()
}
console.log(button)
return button
}
BridgeElement.prototype.getIcon = function() {
@@ -16,3 +20,11 @@ BridgeElement.prototype.getIcon = function() {
return null
}
BridgeElement.prototype.getShowLabel = function() {
return !!this.bridgeAttribute(`show-label`)
}
BridgeElement.prototype.getIsMainAction = function() {
return !!this.bridgeAttribute(`main-action`)
}