Skip to main content

@slack/types / Button

Interface: Button

Defined in: block-kit/block-elements.ts:29

Description​

Allows users a direct path to performing basic actions.

See​

Extends​

Properties​

accessibility_label?​

optional accessibility_label?: string;

Defined in: block-kit/block-elements.ts:63

Description​

A label for longer descriptive text about a button element. This label will be read out by screen readers instead of the button text object. Maximum length for this field is 75 characters.


action_id?​

optional action_id?: string;

Defined in: block-kit/extensions.ts:15

@description: An identifier for this action. You can use this when you receive an interaction payload to identify the source of the action. Should be unique among all other action_ids in the containing block. Maximum length for this field is 255 characters.

Inherited from​

Actionable.action_id


confirm?​

optional confirm?: ConfirmationDialog;

Defined in: block-kit/extensions.ts:25

Description​

A Confirm object that defines an optional confirmation dialog after the element is interacted with.

Inherited from​

Confirmable.confirm


style?​

optional style?: ColorScheme;

Defined in: block-kit/block-elements.ts:58

Description​

Decorates buttons with alternative visual color schemes. Use this option with restraint. primary gives buttons a green outline and text, ideal for affirmation or confirmation actions. primary should only be used for one button within a set. danger gives buttons a red outline and text, and should be used when the action is destructive. Use danger even more sparingly than primary. If you don't include this field, the default button style will be used.


text​

text: PlainTextElement;

Defined in: block-kit/block-elements.ts:38

Description​

A PlainTextElement that defines the button's text. text may truncate with ~30 characters. Maximum length for the text in this field is 75 characters.


type​

type: "button";

Defined in: block-kit/block-elements.ts:33

Description​

The type of element. In this case type is always button.

Overrides​

Actionable.type


url?​

optional url?: string;

Defined in: block-kit/block-elements.ts:49

Description​

A URL to load in the user's browser when the button is clicked. Maximum length for this field is 3000 characters. If you're using url, you'll still receive an interaction payload and will need to send an acknowledgement response.


value?​

optional value?: string;

Defined in: block-kit/block-elements.ts:43

Description​

The value to send along with the interaction payload. Maximum length for this field is 2000 characters.