Skip to content

Icon Button

The Icon Button is a compact push button that shows an icon instead of a text. It is found in the Input - OpenBridge section of the Perspective Component Palette as Icon Button.

Icon Button with a search icon

The Icon Button is one of the input components. Events, disabling, icons and the behavior in the Designer are shared by all of them and are described in Input Components — Common Features. This page covers what is specific to the Icon Button.

An Icon Button with default properties:

Icon Button with default properties

A new Icon Button has the placeholder icon. Choose the icon first.

The Icon Button has no value. When the operator clicks it, it fires the onActionPerformed event once. Configure the event with the action to perform (see Example 1).

Clicking does not change activated; see Activated.

A disabled Icon Button does not fire the event.


icon is an icon picker: choose the icon in the property editor, which sets icon.path, for example openbridge/search. See Icons.

Set hasLabel to true to show a text under the icon, and type the text in label:

With a label With a label, activated
Icon Button with a label Activated Icon Button with a label

With a label the button is 56 px tall instead of 48, and the label can be wider than the button. Make the component’s box large enough for both.

Name Description Property Type
icon The icon on the button. An icon picker; see icon.path. object
icon.path Path of the icon. Default openbridge/placeholder. value
hasLabel Show a label under the icon. Default false. value
label Text of the label. Empty by default. Only shown when hasLabel is true. value

variant selects how prominent the button is:

variant Enabled Activated Disabled
normal (default) The standard button. Normal Normal, activated Normal, disabled
raised A filled button. Raised Raised, activated Raised, disabled
flat No border or background. Flat Flat, activated Flat, disabled
integration For use on an integration bar. Integration Integration, activated Integration, disabled

The integration variant is drawn in the colours of the integration bar. On an ordinary background, as in the images, it is hard to see. The raised variant is also faint when activated is true; use normal or flat for a button that shows an activated state.

Name Description Property Type
variant normal, raised, flat or integration. Default normal. value

Set activated to true to draw the button as selected or switched on. activeColor draws the icon in a stronger colour, in both states:

activeColor = false activeColor = true
activated = false Not activated Not activated, active colour
activated = true Activated Activated, active colour

The component never changes activated itself: a click only fires the event. Bind activated to the state the button represents, or use an Icon Check Button, which toggles on its own.

Name Description Property Type
activated Draw the button as selected. Default false. value
activeColor Draw the icon in a stronger colour. Default false. value

The visible button is 32 px wide inside a 48 px touch area. It is drawn at the left edge of the component’s box and does not stretch with it, so size the box to the button. The blue frame in the images is the component’s box, made wider than the button to show this.

Property Image
none The standard button. Standard width
wide = true The visible button fills the whole 48 px. Wide button
cornerLeft = true The right side is square and reaches the right edge of the 48 px area. Corner left
cornerRight = true The left side is square and reaches the left edge of the 48 px area. Corner right

A cornerLeft button placed directly to the left of a cornerRight button therefore forms one joined pair.

Name Description Property Type
wide Make the visible button 48 px wide instead of 32. Default false. value
cornerLeft Square right side, flush with the right edge. Default false. value
cornerRight Square left side, flush with the left edge. Default false. value

These work in the same way on every input component, and are described in Input Components — Common Features:

Event Description Event Object
onActionPerformed Fired when the operator clicks the button. —

See Events.

  1. Drop an Icon Button into the view and choose the icon openbridge/refresh-google for icon.

  2. Configure the onActionPerformed event with a script action:

    def runAction(self, event):
    system.tag.writeBlocking(['[default]Pump01/Refresh'], [True])

Example 2 — Deck Light Button That Shows Its State

Section titled “Example 2 — Deck Light Button That Shows Its State”
  1. Drop an Icon Button into the view and choose the icon openbridge/lights.

  2. Set hasLabel to true and label to Deck, and set the height of the component to 56.

  3. Bind activated to the tag [default]Lights/Deck/On.

  4. Configure the onActionPerformed event with a script action that toggles the tag:

    def runAction(self, event):
    path = '[default]Lights/Deck/On'
    on = system.tag.readBlocking([path])[0].value
    system.tag.writeBlocking([path], [not on])

Built on the OpenBridge Design System