fox-block-builder
Version:
Maintainable code for loop slack-block-kit-like modal builder
46 lines (45 loc) • 2.47 kB
TypeScript
import { Actionable, ColorScheme, Confirmable, PlainTextElement } from '@slack/web-api';
import { Prop } from '../constants';
/**
* @description Allows users a direct path to performing basic actions.
* @see {@link https://api.slack.com/reference/block-kit/block-elements#button Button element reference}.
* @see {@link https://api.slack.com/interactivity/handling This is an interactive component - see our guide to enabling interactivity}.
*/
export interface FoxButton extends Actionable, Confirmable {
/**
* @description The type of element. In this case `type` is always `button`.
*/
type: 'button';
/**
* @description A {@link PlainTextElement} that defines the button's text. `text` may truncate with ~30 characters.
* Maximum length for the text in this field is 75 characters.
*/
text: PlainTextElement;
/**
* @description The value to send along with the {@link https://api.slack.com/interactivity/handling#payloads interaction payload}.
* Maximum length for this field is 2000 characters.
*/
value?: string;
/**
* @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 {@link https://api.slack.com/interactivity/handling#payloads interaction payload}
* and will need to send an {@link https://api.slack.com/interactivity/handling#acknowledgment_response acknowledgement response}.
*/
url?: string;
/**
* @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.
*/
style?: ColorScheme;
/**
* @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.
*/
accessibility_label?: string;
/** Флаг отпраки формы при клике на кнопку */
[Prop.SubmitOnClick]?: boolean;
}