Skip to main content
Inspiring
Jul 24, 2023 4:07 AM UTC
Question

Customize buttons

Hi Team

Is it possible to customize the buttons? 

1. To display different color in the buttons.

2. Adjust the size of the buttons.

What all different possibilities do we have to customize as below.

    5 replies

    Participating Frequently
    Jul 24, 2023 5:22 AM UTC

    Hi,

    You can display the button in different colors and in different sizes as shown in the above image with the help of cardLayout().

    For more details related to button component please check below link

    https://docs.appian.com/suite/help/23.2/Button_Component.html

    stefanhelzle0001
    Brainy
    Jul 24, 2023 6:12 AM UTC

    Buttons support the styles as described in the documentation.

    https://docs.appian.com/suite/help/23.2/Button_Component.html#button-styles-and-sizes

    Inspiring
    Jul 24, 2023 8:32 AM UTC

    Thanks for the reply

     a!cardLayout(
                    contents: {
                      a!richTextDisplayField(
                        value: {
                          a!richTextItem(
                            text: "APPROVE",
                            color: "POSITIVE",
                            size: "MEDIUM",
                            style: "STRONG"
                          )
                          
                        },
                        align: "CENTER"
                      )
                    },
                    link: a!safeLink(uri: "test", openLinkIn: "NEW_TAB"),
                    height: "AUTO",
                    style: "SUCCESS",
                    shape: "ROUNDED",
                    showShadow: true
                  )

    Participating Frequently
    Jul 24, 2023 12:34 PM UTC

    a!formLayout(
      label: "",
      contents: {
        a!sectionLayout(
          contents: {
            a!columnsLayout(
              columns: {
                a!columnLayout(
                  contents: {a!cardLayout(
                    contents: {
                      a!richTextDisplayField(
                        value: {
                          a!richTextItem(
                            text: {
                              "FORWARD"
                            },
                            color: "#ffffff",
                            size: "MEDIUM",
                            style: {
                              "STRONG"
                            }
                          )
                        },
                        align: "CENTER"
                      )
                    },
                    link: a!safeLink(uri: "test", openLinkIn: "NEW_TAB"),
                    height: "AUTO",
                    style: "#ff9900",
                    shape: "ROUNDED",
                    showShadow: true
                  )}
                ),
                a!columnLayout(
                  contents: {a!cardLayout(
                    contents: {
                      a!richTextDisplayField(
                        value: {
                          a!richTextItem(
                            text: {
                              "REJECT"
                            },
                            color: "#ffffff",
                            size: "MEDIUM",
                            style: {
                              "STRONG"
                            }
                          )
                        },
                        align: "CENTER"
                      )
                    },
                    link: a!safeLink(uri: "test", openLinkIn: "NEW_TAB"),
                    height: "AUTO",
                    style: "#ff0000",
                    shape: "ROUNDED",
                    showShadow: true
                  )}
                ),
                a!columnLayout(
                  contents: {
                    a!cardLayout(
                      contents: {
                        a!richTextDisplayField(
                          value: {
                            a!richTextItem(
                              text: {
                                "APPROVE"
                              },
                              color: "#ffffff",
                              size: "MEDIUM",
                              style: {
                                "STRONG"
                              }
                            )
                          },
                          align: "CENTER"
                        )
                      },
                     
                      height: "AUTO",
                      style: "#00ff00",
                      shape: "ROUNDED",
                      showShadow: true
                    )
                  }
                )
              }
            )
          }
        )
      },
     
    )

    konduruc733182
    Inspiring
    Jul 25, 2023 5:38 AM UTC

    Hello

    You cannot use colors directly in Button Widgets but the sizes can be adjusted (Accepted Values for Sizes "SMALL", "STANDARD" (default), and "LARGE"). As a replacement you can use cards and achieve your requirement. Please look at the below images for different types of button styles and cards.

    a!localVariables(
      local!cardsAsButtons:{
        a!map(
          color:"Red",
          style:"#FF0000"
        ),
        a!map(
          color:"Orange",
          style:"#FFA500"
        ),
        a!map(
          color:"Indigo",
          style:"#4B0082"
        ),
        a!map(
          color:"Blue",
          style:"#0000FF"
        ),
      },
      {
        a!textField(
          label: "Buttons",
          readOnly: true
        ),
        a!columnsLayout(
          columns: {
            
            a!columnLayout(
              contents: {
                a!buttonArrayLayout(
                  align: "CENTER",
                  buttons: {
                    a!buttonWidget(
                      label: "PRIMARY",
                      style: "PRIMARY"
                    )
                  },
                )
              }
            ),
            a!columnLayout(
              contents: {
                a!buttonArrayLayout(
                  align: "CENTER",
                  buttons: {
                    a!buttonWidget(
                      label: "SECONDARY",
                      style: "SECONDARY"
                    )
                  }
                )
              }
            ),
            a!columnLayout(
              contents: {
                a!buttonArrayLayout(
                  buttons: {
                    a!buttonWidget(
                      label: "DESTRUCTIVE",
                      style: "DESTRUCTIVE"
                    )
                  },
                  align: "CENTER",
                )
              }
            ),
            a!columnLayout(
              contents: {
                a!buttonArrayLayout(
                  buttons: {
                    a!buttonWidget(
                      label: "LINK",
                      style: "LINK"
                    )
                  },
                  align: "CENTER",
                )
              }
            )
          }
        ),
        a!textField(
          label: "Cards as Buttons",
          readOnly: true
        ),
        a!columnsLayout(
          columns: a!forEach(
            items:local!cardsAsButtons,
            expression: {
              a!columnLayout(
                contents: a!cardLayout(
                  contents: {
                    a!richTextDisplayField(
                      align: "CENTER",
                      value: a!richTextItem(
                        text: index(fv!item,"color",null)
                      )
                    )
                  },
                  style: index(fv!item,"style",null),
                  link: a!dynamicLink()
                )
              )
            }
          )
        )
      }
    )