Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 42 additions & 1 deletion packages/types/src/block-kit/blocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@ import type {
URLInput,
WorkflowButton,
} from './block-elements';
import type { PlainTextElement, SlackFileImageObject, TextObject, UrlImageObject } from './composition-objects';
import type {
PlainTextElement,
RawTextElement,
SlackFileImageObject,
TextObject,
UrlImageObject,
} from './composition-objects';

export interface Block {
/**
Expand Down Expand Up @@ -57,6 +63,7 @@ export type KnownBlock =
| MarkdownBlock
| RichTextBlock
| SectionBlock
| TableBlock
| VideoBlock;

/**
Expand Down Expand Up @@ -361,6 +368,40 @@ export interface SectionBlock extends Block {
expand?: boolean;
}

/**
* @description Displays structured information in a table.
* @see {@link https://docs.slack.dev/reference/block-kit/blocks/table-block Table block reference}.
*/
export interface TableBlock extends Block {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Praise!

/**
* @description The type of block. For a table block, `type` is always `table`.
*/
type: 'table';
/**
* @description An array consisting of table rows. Maximum 100 rows. Each row object is an array with a max of 20 table cells. Table cells can have a type of raw_text or rich_text.
*/
rows: (RichTextBlock | RawTextElement)[][];
/**
* @description An array describing column behavior. If there are fewer items in the column_settings array than there are columns in the table, then the items in the the column_settings array will describe the same number of columns in the table as there are in the array itself. Any additional columns will have the default behavior. Maximum 20 items.
*/
column_settings?: TableBlockColumnSettings[];
}

/**
* Schema for column_settings of the table block.
* @see {@link https://docs.slack.dev/reference/block-kit/blocks/table-block/#schema-for-column_settings}.
*/
interface TableBlockColumnSettings {
/**
* @description The alignment for items in this column. Can be left, center, or right. Defaults to left if not defined.
*/
align?: 'left' | 'center' | 'right';
/**
* @description Whether the contents of this column should be wrapped or not. Defaults to false if not defined.
*/
is_wrapped?: boolean;
}

/**
* @description Displays an embedded video player. A video block is designed to embed videos in all app surfaces (e.g.
* link unfurls, messages, modals, App Home) — anywhere you can put blocks! To use the video block within your app, you
Expand Down
15 changes: 15 additions & 0 deletions packages/types/src/block-kit/composition-objects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,21 @@ export interface MrkdwnElement {
verbatim?: boolean;
}

/**
* @description Defines an object containing some text.
* @see {@link https://docs.slack.dev/reference/block-kit/composition-objects/text-object Text object reference}.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 note: This is undocumented as a text object at this time. I've sent a message related to this but believe this is the correct place for the raw_text reference and implementation!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sweet 💯

*/
export interface RawTextElement {
/**
* @description The formatting to use for this text object.
*/
type: 'raw_text';
/**
* @description The text for the block. The minimum length is 1 and maximum length is 3000 characters.
*/
text: string;
}

interface BaseConversationFilter {
/**
* @description Indicates which type of conversations should be included in the list. When this field is provided, any
Expand Down
Loading