优特云
[ { "name": "首页", "url": "http://www.utyun.com/", "target": "0", "child": [] }, { "name": "活动", "url": "http://www.utyun.com/h-col-141.html", "target": "0", "child": [] }, { "name": "产品", "url": "", "target": "1", "child": [ { "name": "U语言", "url": "http://www.utyun.com/h-col-176.html", "target": "0", "child": [] }, { "name": "U平台", "url": "http://www.utyun.com/h-col-150.html", "target": "0", "child": [] } ] }, { "name": "技术与服务", "url": "", "target": "1", "child": [ { "name": "运维服务", "url": "http://www.utyun.com/h-col-161.html", "target": "0", "child": [] }, { "name": "技术方案", "url": "http://www.utyun.com/h-col-178.html", "target": "0", "child": [] } ] }, { "name": "优特云学院", "url": "", "target": "1", "child": [ { "name": "教程", "url": "http://www.utyun.com/h-col-166.html", "target": "0", "child": [] }, { "name": "下载中心", "url": "http://www.utyun.com/h-col-170.html", "target": "0", "child": [] }, { "name": "论坛", "url": "http://www.utyun.com/h-col-169.html", "target": "0", "child": [] } ] }, { "name": "关于优特云", "url": "", "target": "1", "child": [ { "name": "企业概况", "url": "http://www.utyun.com/h-col-171.html", "target": "0", "child": [] }, { "name": "新闻动态", "url": "http://www.utyun.com/h-col-172.html", "target": "0", "child": [] }, { "name": "加入我们", "url": "http://www.utyun.com/h-col-173.html", "target": "0", "child": [] }, { "name": "团队风采", "url": "http://www.utyun.com/h-col-140.html", "target": "0", "child": [] } ] } ]
展示组件1
按钮组

用户5594 最后一次编辑

4 个月前 7


description: Learn how to use the Button Group widget for selecting multiple items from predefined choices.

Button Group

This page provides information on using the Button Group widget, which allows you to create a group of buttons, including menu buttons with drop-down items.

<VideoEmbed host="youtube" videoId="oWGK1s5nGns" title="How to use Button Group Widget" caption="How to use Button Group Widget"/>

Content properties

These properties are customizable options present in the property pane of the widget, allowing users to modify the widget according to their preferences.

Data

Buttons string

Specify the buttons available in the group. You can rearrange the buttons and configure them by clicking the gear icon ⚙️. See the Buttons reference guide for configuring individual buttons in the group.

General

Visible boolean

Controls the visibility of the widget. If you turn off this property, the widget is not visible in View Mode. Additionally, you can use JavaScript by clicking on JS next to the Visible property to control the widget's visibility conditionally.

For example, if you want to make the widget visible only when the user selects "Yes" from a Select widget, you can use the following JavaScript expression:

{{Select1.selectedOptionValue === "Yes"}}

Disabled boolean

Prevents users from selecting the widget. Even though the widget remains visible, user input is not permitted. Additionally, you can use JavaScript by clicking on JS next to the Disabled property to control the widget's disable state conditionally.

For example, if you want to allow only a specific user to select menu item, you can use the following JavaScript expression:

{{appsmith.user.email=="john@appsmith.com"?false:true}}

Animate Loading boolean

Controls whether the widget is displayed with a loading animation. When enabled, the widget shows a skeletal animation during the loading process. Additionally, you can control it through JavaScript by clicking on the JS next to the property.

Style properties

Style properties allow you to change the look and feel of the widget.

General

Button variant string

Specifies the style type of the button to indicate its significance.

Options:

  • Primary: Fills the button with color.
  • Secondary: Adds a colored border to the button while keeping the button itself white.
  • Tertiary: This option does not apply any specific styling changes to the button.

This property can be dynamically set using JavaScript by providing a string value of

PRIMARY, SECONDARY, or TERTIARY.

Orientation string

Determines the arrangement of buttons in the button group, either horizontally or vertically.

Border and shadow

Border radius string

Applies rounded corners to the outer edge of the widget. If JavaScript is enabled, you can specify valid CSS border-radius to adjust the radius of the corners.

Box Shadow string

This property adds a drop shadow effect to the frame of the widget. If JavaScript is enabled, you can specify valid CSS box-shadow values to customize the appearance of the shadow.

Reference properties

Reference properties are properties that are not available in the property pane but can be accessed using the dot operator in other widgets or JavaScript functions. They provide additional information or allow interaction with the widget programmatically. For instance, to get the visibility status, you can use ButtonGroup1.isVisible.

isVisible boolean

The

isVisible property indicates the visibility state of a widget, with true indicating it is visible and false indicating it is hidden.

Example:

{{ButtonGroup1.isVisible}}

Methods

Widget property setters enable you to modify the values of widget properties at runtime, eliminating the need to manually update properties in the editor.

These methods are asynchronous, and you can use the .then() block to ensure execution and sequencing of subsequent lines of code in Appsmith.

setVisibility boolean

Sets the visibility of the widget.

Example:

ButtonGroup1.setVisibility(true)

To perform sequential actions, use the .then() block for execution.

ButtonGroup1.setVisibility(true).then(() => {
  // code to be executed after visibility is set
})

setDisabled boolean

Sets the disabled state of the widget.

Example:

ButtonGroup1.setDisabled(false)

To perform sequential actions, use the .then() block for execution.

ButtonGroup1.setDisabled(false).then(() => {
  // code to be executed after disabled state is set
})

优特云