Skip to content

button

A control that can trigger a function when pressed.

Properties

Name Type Default Description
label(★) dynamic(str|Icon) ""

The label displayed in the button.

on_action Callback

The name of a function that is triggered when the button is pressed. The parameters of that function are all optional:

  • state (State): the state instance.
  • id (optional[str]): the identifier of the button.
  • action (optional[str]): the name of the action that provoked the change.

active dynamic(bool) True

Indicates if this component is active. An inactive component allows no user interaction.

id str

The identifier that will be assigned to the rendered HTML component.

properties dict[str, any]

Bound to a dictionary that contains additional properties for this element.

class_name str

List of CSS class names that will be associated with the generated HTML Element. This class names will be added to the default taipy-<element_type>.

hover_text dynamic(str)

Information that is displayed when the user hovers over this element.

(★)label is the default property for this visual element.

Usage

Simple text

The button label, which is the button control's default property, is simply displayed as the button text.

Page content

<|Button Label|button|>
<taipy:button>Button Label</taipy:button>

Specific action callback

Button can specify a callback function to be invoked when the button is pressed.

Page content

<|Button Label|button|on_action=button_action_function_name|>
<taipy:button on_action="button_action_function_name">Button Label</taipy:button>