### Building a Simple Slack Modal Dialog with Block Builder Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/getting-started.md This example demonstrates the general hierarchy of Slack Block Kit objects in action by constructing a simple modal dialog. It illustrates how to use Surfaces (Modal), Blocks (Section, Input), Elements (UserSelect), and Composition Objects (ConfirmationDialog) to create an interactive Slack view. ```javascript import { Modal, Blocks, Elements, Bits } from 'slack-block-builder; const myModal = () => { return Modal({ title: 'Hello World' }) .blocks( Blocks.Section({ text: 'This is just a super simple example.'}), Blocks.Input({ label: 'Who\'s your favorite colleague?' }) .element( Elements.UserSelect({ placeholder: 'I\'ll keep it a secret...'}) .confirm( Bits.ConfirmationDialog({ title: 'You sure that\'s your favorite?', text: 'There\'s no turning back.', confirm: 'Yep', deny: 'On Second Thought' })))) .buildToJSON(); }; ``` -------------------------------- ### Install Slack Block Builder Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/installation.md Instructions for installing the `slack-block-builder` library using either npm or yarn. The library has no external dependencies. ```bash npm install --save slack-block-builder ``` ```bash yarn add slack-block-builder ``` -------------------------------- ### Importing Core Components from Slack Block Builder Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/getting-started.md This snippet shows the top-level imports available from the 'slack-block-builder' library. It highlights how to import Surface creation methods (Message, Modal, HomeTab) and category objects (Blocks, Elements, Bits) for building Slack UI components. ```javascript import { Message, Modal, HomeTab, Blocks, Elements, Bits } from 'slack-block-builder'; ``` -------------------------------- ### Example Output Strings from `actionId` Function Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/components/paginator.md Shows the resulting string values generated by the example `actionId` function for 'Next' and 'Previous' buttons, suitable for Slack `action_id` attributes. ```javascript '{"page":4,"offset":15,"buttonId":"next","action":"render-certain-modal"}' ``` ```javascript '{"page":2,"offset":5,"buttonId":"previous","action":"render-certain-modal"}' ``` -------------------------------- ### Install Slack Block Builder v2 Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/announcements/version-2.md Instructions to install the Slack Block Builder library version 2.0.1 using npm. This command adds the package as a dependency to your project. ```bash npm install --save slack-block-builder@2.0.1 ``` -------------------------------- ### Create Slack Modal Dialog with Block Builder Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/examples.md This JavaScript snippet illustrates how to build a Slack modal dialog using the `slack-block-builder` library. It includes various input elements like text inputs and a static select menu, demonstrating both direct parameter passing and chained setter methods for constructing the modal. ```javascript import { Modal, Blocks, Elements, Bits } from 'slack-block-builder'; const myModal = () => { return Modal({ title: 'PizzaMate', submit: 'Get Fed' }) .blocks( Blocks.Section({ text: 'Hey there, colleague!' }), Blocks.Section({ text: 'Hurray for corporate pizza! Let\'s get you fed and happy :pizza:' }), Blocks.Input({ label: 'What can we call you?' }) .element( Elements.TextInput({ placeholder: 'Hi, my name is... (What?!) (Who?!)' }) .actionId('name')), Blocks.Input({ label: 'Which floor are you on?' }) .element( Elements.TextInput({ placeholder: 'HQ – Fifth Floor' }) .actionId('floor')), Blocks.Input({ label: 'What\'ll you have?' }) .element( Elements.StaticSelect({ placeholder: 'Choose your favorite...' }) .actionId('item') .options( Bits.Option({ text: ':cheese_wedge: With Cheeze', value: '012' }), Bits.Option({ text: ':fish: With Anchovies', value: '013' }), Bits.Option({ text: ':cookie: With Scooby Snacks', value: '014' }), Bits.Option({ text: ':beer: I Prefer Steak and Beer', value: '015' })))) .buildToJSON(); }; ``` ```javascript import { Modal, Blocks, Elements, Bits } from 'slack-block-builder'; const myModal = () => { return Modal() .title('PizzaMate') .blocks( Blocks.Section() .text('Hey there, colleague!'), Blocks.Section() .text('Hurray for corporate pizza! Let\'s get you fed and happy :pizza:'), Blocks.Input() .label('What can we call you?') .element( Elements.TextInput() .placeholder('Hi, my name is... (What?!) (Who?!)') .actionId('name')), Blocks.Input() .label('Which floor are you on?') .element( Elements.TextInput() .placeholder('HQ – Fifth Floor') .actionId('floor')), Blocks.Input() .label('What\'ll you have?') .element( Elements.StaticSelect() .placeholder('Choose your favorite...') .actionId('item') .options( Bits.Option().text(':cheese_wedge: With Cheeze').value('012'), Bits.Option().text(':fish: With Anchovies').value('013'), Bits.Option().text(':cookie: With Scooby Snacks').value('014'), Bits.Option().text(':beer: I Prefer Steak and Beer').value('015')))) .submit('Get Fed') .buildToJSON(); }; ``` -------------------------------- ### Install Slack Block Builder using NPM Source: https://github.com/raycharius/slack-block-builder/blob/main/README.md This command installs the Slack Block Builder library into your project using the Node Package Manager (NPM). It adds the package as a dependency, making it available for use in your application. ```bash npm install --save slack-block-builder ``` -------------------------------- ### Install Slack Block Builder using Yarn Source: https://github.com/raycharius/slack-block-builder/blob/main/README.md This command installs the Slack Block Builder library into your project using Yarn. It adds the package as a dependency, making it available for use in your application. ```bash yarn add slack-block-builder ``` -------------------------------- ### Create Interactive Slack Message with Block Builder Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/examples.md This JavaScript snippet demonstrates how to construct an interactive Slack message using the `slack-block-builder` library. It includes sections, a divider, and action buttons, showcasing both direct parameter passing and chained setter methods for building the message object. ```javascript import { Message, Blocks, Elements } from 'slack-block-builder'; const myMessage = ({ channel }) => { return Message({ channel, text: 'Alas, my friend.' }) .blocks( Blocks.Section({ text: 'One does not simply walk into Slack and click a button.' }), Blocks.Section({ text: 'At least that\'s what my friend Slackomir said :crossed_swords:' }), Blocks.Divider(), Blocks.Actions() .elements( Elements.Button({ text: 'Sure One Does', actionId: 'gotClicked' }) .danger(), Elements.Button({ text: 'One Does Not', actionId: 'scaredyCat' }) .primary())) .asUser() .buildToJSON(); }; ``` ```javascript import { Message, Blocks, Elements } from 'slack-block-builder'; const myMessage = ({ channel }) => { return Message() .channel(channel) .text('Alas, my friend.') .blocks( Blocks.Section() .text('One does not simply walk into Slack and click a button.'), Blocks.Section() .text('At least that\'s what my friend Slackomir said :crossed_swords:'), Blocks.Divider(), Blocks.Actions() .elements( Elements.Button() .text('Sure One Does') .actionId('gotClicked') .danger(), Elements.Button() .text('One Does Not') .actionId('scaredyCat') .primary())) .asUser() .buildToJSON(); }; ``` -------------------------------- ### Building a Slack Modal with Dynamic Select Options (JavaScript) Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/examples.md This JavaScript code snippet illustrates how to construct a Slack modal using the 'slack-block-builder' library. It demonstrates the use of various block types including Section, Input with TextInput, and Input with StaticSelect. A key feature is the dynamic population of the StaticSelect options by mapping an array of 'menu' items to 'Bits.Option' objects, enabling the modal to present a customizable list of choices to the user. ```javascript import { Modal, Blocks, Elements, Bits } from 'slack-block-builder'; const myModal = ({ menu }) => { // Pass in an array of menu items from data source return Modal({ title: 'PizzaMate', submit: 'Get Fed' }) .blocks( Blocks.Section({ text: 'Hey there, colleague!' }), Blocks.Section({ text: 'Hurray for corporate pizza! Let\'s get you fed and happy :pizza:' }), Blocks.Input({ label: 'What can we call you?' }) .element( Elements.TextInput({ placeholder: 'Hi, my name is... (What?!) (Who?!)' }) .actionId('name')), Blocks.Input({ label: 'Which floor are you on?' }) .element( Elements.TextInput({ placeholder: 'HQ – Fifth Floor' }) .actionId('floor')), Blocks.Input({ label: 'What\'ll you have?' }) .element( Elements.StaticSelect({ placeholder: 'Choose your favorite...' }) .actionId('item') .options(menu.map((item) => Bits.Option({ text: item.name, value: item.id }))))) // Map items to Option objects .buildToJSON(); }; ``` -------------------------------- ### Example: EasyPaginator in a Slack Modal Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/components/easy-paginator.md This JavaScript example demonstrates integrating `EasyPaginator` into a Slack `Modal` to display a list of tasks. It illustrates passing the full `tasks` array, configuring `perPage` and `page`, and using `blocksForEach` to render individual task items. The `actionId` is set up to pass `page` and `offset` parameters to the backend when navigation buttons are clicked. ```javascript import { Modal, Blocks, Elements, EasyPaginator } from 'slack-block-builder'; export default ({ tasks, page, perPage }) => Modal({ title: 'Open Tasks' }) .blocks( Blocks.Section({ text: 'Hi! :wave: And welcome to the FAQ section! Take a look around and if you don\'t find what you need, feel free to open an issue on GitHub.' }), Blocks.Section({ text: `You currently have *${tasks.length} open task(s)*:` }), EasyPaginator({ perPage, items: tasks, // The entire data set page: page || 1, actionId: ({ page, offset }) => JSON.stringify({ action: 'render-tasks', page, offset }), blocksForEach: ({ item }) => [ Blocks.Divider(), Blocks.Section({ text: `*${item.title}*` }) .accessory( Elements.Button({ text: 'View Details' }) .actionId('view-details') .value(item.id.toString())), Blocks.Section({ text: `*Due Date:* ${getDate(item.dueDate)}` }), ], }).getBlocks()) .close('Done') .buildToJSON(); ``` -------------------------------- ### Creating Slack Messages: Chaining vs. Params Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/introduction.md These examples demonstrate two ways to construct a Slack message using Block Builder, both yielding identical results. The first uses pure method chaining for all property settings, while the second combines initial parameter setting for primitive properties with subsequent chaining for more complex elements like blocks. ```javascript import { Message, Blocks } from 'slack-block-builder'; const myMessage = ({ channel, imageUrl }) => { return Message() .channel(channel) .text('Let\'s talk about those hand dryers.') .blocks( Blocks.Image() .imageUrl(imageUrl) .altText('Portrait of Sheldon Cooper') .title('Hand Dryer\'s Arch Enemy')) .asUser() .buildToJSON(); }; ``` ```javascript import { Message, Blocks } from 'slack-block-builder'; const myMessage = ({ channel, imageUrl }) => { return Message({ channel, text: 'Let\'s talk about those hand dryers.' }) .blocks( Blocks.Image({ imageUrl, title: 'Hand Dryer\'s Arch Enemy' }) .altText('Portrait of Sheldon Cooper')) .asUser() .buildToJSON(); }; ``` -------------------------------- ### Example Payloads for `actionId` Function Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/components/paginator.md Illustrates the data structure passed to the `actionId` function for 'Next' and 'Previous' buttons, showing how pagination state (page, offset, totals) is provided. ```javascript { buttonId: 'next', page: 4, perPage: 5, totalItems: 57, totalPages: 12, offset: 15, } ``` ```javascript { buttonId: 'previous', page: 2, perPage: 5, totalItems: 57, totalPages: 12, offset: 5, } ``` -------------------------------- ### ChannelMultiSelectBuilder API Reference Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/elements/channel-multi-select.md Detailed API documentation for the `ChannelMultiSelectBuilder` object, including its constructor parameters and all chainable setter methods. Each method's purpose, parameters, and return value are described, providing a comprehensive guide for configuring the Slack Channel Multi-Select element. ```APIDOC ChannelMultiSelectBuilder: __init__(params?): actionId: String maxSelectedItems: Int placeholder: String initialChannels([string1[, ...[, stringN]]): Pre-populates the menu with selected, default channels. focusOnLoad(boolean?): Sets an element to have auto focus on opening the view. Defaults to 'true'. actionId(string): Sets a string to be an identifier for the action taken by the user. It is sent back to your app in the interaction payload when the element is interacted or when the view is submitted. confirm(ConfirmationDialog): For confirmation dialogs, sets the text of the button that confirms the action to which the confirmation dialog has been added. For elements, adds a confirmation dialog that is displayed when the user interacts with the element to confirm the selection or action. maxSelectedItems(int): Sets a limit to how many items the user can select in the multi-select menu. placeholder(string): Defines the text displayed as a placeholder in the empty input element. end(): Performs no alterations to the object on which it is called. It is meant to simulate a closing HTML tag for those who prefer to have an explicit end declared for an object. ``` -------------------------------- ### Basic Accordion Component Instantiation Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/components/accordion.md These examples demonstrate the fundamental ways to instantiate the `Accordion` component in `slack-block-builder`, either through direct import or by accessing it via the `Components` object. Both methods show how to create an accordion instance and retrieve the resulting Block Kit blocks using `getBlocks()`. ```javascript import { Accordion } from 'slack-block-builder'; const accordion = Accordion(params); const blocks = accordion.getBlocks(); ``` ```javascript import { Accordion } from 'slack-block-builder'; const accordion = Components.Accordion(params); const blocks = accordion.getBlocks(); ``` -------------------------------- ### Paginator Component Full Example with Modal Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/components/paginator.md This example demonstrates how to integrate the Paginator component within a Slack Modal using `slack-block-builder`. It shows how to pass data like tasks, total tasks, and current page, and how to define the `actionId` for navigation buttons and `blocksForEach` to render individual items. ```javascript import { Modal, Blocks, Elements, Paginator } from 'slack-block-builder'; export default ({ tasks, totalTasks, page, perPage }) => Modal({ title: 'Open Tasks' }) .blocks( Blocks.Section({ text: 'Hi! :wave: And welcome to the FAQ section! Take a look around and if you don\'t find what you need, feel free to open an issue on GitHub.' }), Blocks.Section({ text: `You currently have *${totalTasks} open task(s)*:` }), Paginator({ perPage, items: tasks, totalItems: totalTasks, page: page || 1, actionId: ({ buttonId, page, offset }) => JSON.stringify({ action: 'render-tasks', buttonId, page, offset }), blocksForEach: ({ item }) => [ Blocks.Divider(), Blocks.Section({ text: `*${item.title}*` }) .accessory( Elements.Button({ text: 'View Details' }) .actionId('view-details') .value(item.id.toString())), Blocks.Section({ text: `*Due Date:* ${getDate(item.dueDate)}` }), ], }).getBlocks()) .close('Done') .buildToJSON(); ``` -------------------------------- ### JavaScript: Appending Method with Multiple Arguments Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/setter-methods.md Example demonstrating how to pass multiple arguments to an appending setter method in a single call, adding several blocks simultaneously. ```javascript const myModal = () => { return Modal({ title: 'Multiple Args Example' }) .blocks( Blocks.Section({ text: 'This is the first section.' })) .blocks( Blocks.Section({ text: 'This is the second section.' }), Blocks.Section({ text: 'This is the third section.' })) .buildToJSON(); }; ``` -------------------------------- ### Create ButtonBuilder Instance in JavaScript Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/elements/button.md These examples demonstrate how to instantiate a new `ButtonBuilder` object from the `slack-block-builder` library. You can either import `Button` directly or access it via the `Elements` category. Optional parameters can be passed during instantiation to set initial primitive values. ```javascript import { Button } from 'slack-block-builder'; const myObj = Button(params?); ``` ```javascript import { Elements } from 'slack-block-builder'; const myObj = Elements.Button(params?); ``` -------------------------------- ### JavaScript: Appending Method with Single Argument Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/setter-methods.md Example demonstrating how to pass a single argument to an appending setter method, adding one block at a time. ```javascript const myModal = () => { return Modal({ title: 'Single Arg Example' }) .blocks( Blocks.Section({ text: 'This is the first section.' })) .blocks( Blocks.Section({ text: 'This is the second section.' })) .blocks( Blocks.Section({ text: 'This is the third section.' })) .buildToJSON(); }; ``` -------------------------------- ### Create Slack Modal with Accordion Component Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/components/accordion.md This example demonstrates how to construct a complete Slack modal using `slack-block-builder`, incorporating the `Accordion` component to display a list of FAQs. It shows how to pass data, manage expanded states, and define dynamic content for accordion items. ```javascript import { Modal, Blocks, Accordion } from 'slack-block-builder'; export default ({ faqs, expandedItems }) => Modal({ title: 'FAQ' }) .blocks( Blocks.Section({ text: 'Hi! :wave: And welcome to the FAQ section! Take a look around and if you don\'t find what you need, feel free to open an issue on GitHub.'}), Blocks.Divider(), Accordion({ items: faqs, expandedItems: expandedItems || [], // In this case, the value is [1] collapseOnExpand: true, titleText: ({ item }) => `*${item.question}*`, actionId: ({ expandedItems }) => JSON.stringify({ action: 'render-faqs', expandedItems }), blocksForExpanded: ({ item }) => [ Blocks.Section({ text: `${item.answer}` }), ], }).getBlocks()) .close('Done') .buildToJSON(); ``` -------------------------------- ### Using Slack Block Builder Markdown Helpers in JavaScript Source: https://github.com/raycharius/slack-block-builder/blob/main/README.md This JavaScript example demonstrates how to use the `Md` object and its helper functions (like `Md.user`, `Md.italic`, `Md.codeInline`, `Md.listBullet`) within the Slack Block Builder to format text in a Slack message. It constructs a message with sections, user mentions, italicized text, and a bulleted list of slash commands, then builds it into a JSON object for Slack's Block Kit API. ```javascript import { Message, Blocks, Md } from 'slack-block-builder'; export default ({ channel, user }) => { const slashCommands = ['/schedule', '/cancel', '/remind', '/help']; return Message({ channel, text: 'Alas, my friend.' }) .blocks( Blocks.Section({ text: `:wave: Hi there, ${Md.user(user)}!` }), Blocks.Section({ text: `${Md.italic('Sorry')}, I didn't get that. Why don't you try out some of my slash commands?` }), Blocks.Section({ text: `Here are some of the things that I can do:` }), Blocks.Section() .text(Md.listBullet(slashCommands .map((item) => Md.codeInline(item))))) .asUser() .buildToObject(); }; ``` -------------------------------- ### Generate Slack Block Kit Builder Preview URL Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/build-methods.md The `printPreviewUrl()` method logs a URL to the console that opens the Slack Block Kit Builder website with your view's data pre-filled in the query string. This is highly beneficial for rapid prototyping and visual debugging of UI layouts. ```javascript Message.printPreviewUrl() ``` ```javascript Modal.printPreviewUrl() ``` ```javascript HomeTab.printPreviewUrl() ``` -------------------------------- ### Instantiating NumberInputBuilder in JavaScript Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/elements/number-input.md Demonstrates two ways to create a new instance of `NumberInputBuilder` using the `slack-block-builder` library: direct import of `NumberInput` or via the `Elements` category. ```javascript import { NumberInput } from 'slack-block-builder'; const myObj = NumberInput(params?); ``` ```javascript import { Elements } from 'slack-block-builder'; const myObj = Elements.NumberInput(params?); ``` -------------------------------- ### Instantiate OptionBuilder Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/bits/option.md Demonstrates two methods for creating a new instance of the `OptionBuilder` object: direct import of `Option` or accessing `Option` as a member of the `Bits` category. ```javascript import { Option } from 'slack-block-builder'; const myObj = Option(params?); ``` ```javascript import { Bits } from 'slack-block-builder'; const myObj = Bits.Option(params?); ``` -------------------------------- ### Creating ConfirmationDialogBuilder Instances Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/bits/confirmation-dialog.md Demonstrates two ways to create a new instance of `ConfirmationDialogBuilder`: as a top-level import and as a member of the `Bits` category. Both methods allow optional parameters to be passed during instantiation. ```javascript import { ConfirmationDialog } from 'slack-block-builder'; const myObj = ConfirmationDialog(params?); ``` ```javascript import { Bits } from 'slack-block-builder'; const myObj = Bits.ConfirmationDialog(params?); ``` -------------------------------- ### Creating FileBuilder Instance Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/blocks/file.md Demonstrates how to create a new instance of `FileBuilder` using either a top-level import or as a member of the `Blocks` category. ```javascript import { File } from 'slack-block-builder'; const myObj = File(params?); ``` ```javascript import { Blocks } from 'slack-block-builder'; const myObj = Blocks.File(params?); ``` -------------------------------- ### Create HomeTabBuilder Instance Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/surfaces/home-tab.md Demonstrates how to create a new instance of the HomeTabBuilder object, either as a top-level import or via the Surfaces category, optionally passing initial parameters. ```javascript import { HomeTab } from 'slack-block-builder'; const myObj = HomeTab(params?); ``` ```javascript import { Surfaces } from 'slack-block-builder'; const myObj = Surfaces.HomeTab(params?); ``` -------------------------------- ### Basic Usage and Import Methods for EasyPaginator Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/components/easy-paginator.md This JavaScript snippet demonstrates the fundamental usage of `EasyPaginator` and two common ways to import it: directly as a top-level import or as a member of the `Components` object. Both methods show how to instantiate the paginator and then call `getBlocks()` to retrieve the generated Slack Block Kit UI elements. ```javascript import { EasyPaginator } from 'slack-block-builder'; const paginator = EasyPaginator(params); const blocks = paginator.getBlocks(); ``` ```javascript import { Components } from 'slack-block-builder'; const paginator = Components.EasyPaginator(params); const blocks = paginator.getBlocks(); ``` -------------------------------- ### ContextBuilder Constructor Parameters Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/blocks/context.md This section describes the optional parameters that can be passed directly to the `ContextBuilder` instantiating function. These parameters correspond to chainable setter methods, offering an alternative way to initialize properties. For detailed explanations of each parameter, refer to their respective setter method documentation. ```APIDOC ContextBuilder(params?) params: blockId: String - An identifier for any given block in a view or message. For an explanation, see its corresponding setter method below. ``` -------------------------------- ### JavaScript: Setter Method Immutability Example Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/setter-methods.md Demonstrates that calling a setter method for a property that has already been set (e.g., `title()`) will result in an error, enforcing immutability for single-value properties. ```javascript const myModal = () => { return Modal() .title('My Modal') // Sets the title of the modal .blocks( /* Imagine Blocks */ ) .title('My Modal') // Will throw an error, as it has already been set through the 'title()' method .buildToJSON(); }; ``` -------------------------------- ### HomeTabBuilder.printPreviewUrl() Method Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/surfaces/home-tab.md Calls the getPreviewUrl method to generate the preview URL and then logs it directly to the console for convenience. ```javascript HomeTabBuilder.printPreviewUrl(); ``` -------------------------------- ### Paginator Component Usage with TypeScript Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/components/paginator.md This example demonstrates how to use the Paginator component with TypeScript, specifically showing how to dictate the shape of the items array using a generic type parameter like `Entity` for type safety. ```javascript import { Paginator } from 'slack-block-builder'; const paginator = Paginator(params); const blocks = paginator.getBlocks(); ``` -------------------------------- ### WorkflowStepBuilder.printPreviewUrl Method Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/surfaces/workflow-step.md Calls `getPreviewUrl` to generate the preview URL and then logs it directly to the console for convenience. ```APIDOC WorkflowStepBuilder.printPreviewUrl(): Returns: void - Logs the preview URL to the console. ``` -------------------------------- ### Using AttachmentCollection with Slack WebClient Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/other/attachment-collection.md This example demonstrates how to use `AttachmentCollection` along with `BlockCollection` when posting a message using Slack's Node SDK `WebClient`. It shows how to separate UI representation (blocks and attachments) from message configuration within your application. ```javascript import { BlockCollection, AttachmentCollection, Blocks } from 'slack-block-builder'; import { WebClient } from '@slack/web-api'; const client = new WebClient(process.env.SLACK_TOKEN); client.chat.postMessage({ channel: 'ABCDEFG', text: 'Hello, my dear, sweet world!', blocks: BlockCollection( /* Pass in blocks */ ), attachments: AttachmentCollection( /* Pass in attachments */ ), }) .then((response) => console.log(response)) .catch((error) => console.log(error)); ``` -------------------------------- ### Creating ChannelSelectBuilder Instance Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/elements/channel-select.md Demonstrates how to create a new instance of `ChannelSelectBuilder` using either a top-level import or from the `Elements` category. ```javascript import { ChannelSelect } from 'slack-block-builder'; const myObj = ChannelSelect(params?); ``` ```javascript import { Elements } from 'slack-block-builder'; const myObj = Elements.ChannelSelect(params?); ``` -------------------------------- ### Accordion Component Parameters Reference Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/components/accordion.md This section details the various parameters available for configuring the `Accordion` component in `slack-block-builder`. It describes each parameter's type, purpose, and whether it is optional, providing a comprehensive guide for customizing accordion behavior. ```APIDOC Accordion Component Parameters: items: Array Description: An array of the items that are to be included in the expandable list. expandedItems: Array Description: An array of integers (indexes of expanded items) that dictates which items should be expanded. Should default to either [] for all items to be collapsed, or [items[index]] for a default expanded item. Then it should be updated with each view update using the data provided in the action_id of each button. titleText: Function Description: This is a function called to create the title next to the collapse/expand button. It takes an object containing 'item' (one of the data set items) and returns a string. Parameters: item: Object Description: The item for which the title will be displayed. actionId: Function Description: This is a function called to create the action_id of the buttons used to expand or collapse an item. blocksForExpanded: Function Description: The function that is called for each expanded item that should return the blocks to be displayed. collapseOnExpand: Boolean (Optional) Description: When set to true, only one item will be expanded at any given time. Expanding a new item will collapse the currently expanded one. Defaults to false. expandButtonText: String (Optional) Description: Used to customize the text for the expand button, which defaults to 'More'. collapseButton: String (Optional) Description: Used to customize the text for the collapse button, which defaults to 'Close'. isExpandable: Function (Optional) Description: Used to show/hide expand/collapse button for a given item. ``` -------------------------------- ### ContextBuilder.end() Method Example Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/blocks/context.md The `end()` method performs no functional alterations to the `ContextBuilder` object. Its primary purpose is to simulate a closing HTML tag, offering an explicit end declaration for the object. This can improve code readability for developers who prefer a more structured, tag-like syntax. ```javascript ContextBuilder.end(); ``` -------------------------------- ### Instantiating TextInputBuilder in JavaScript Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/elements/text-input.md Demonstrates two ways to create a new instance of the `TextInputBuilder` object: via a top-level import or as a member of the `Elements` category from the `slack-block-builder` library. Both methods accept optional parameters for primitive properties. ```javascript import { TextInput } from 'slack-block-builder'; const myObj = TextInput(params?); ``` ```javascript import { Elements } from 'slack-block-builder'; const myObj = Elements.TextInput(params?); ``` -------------------------------- ### Using EasyPaginator with TypeScript Generics Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/components/easy-paginator.md This TypeScript example illustrates how to use `EasyPaginator` with type safety. It demonstrates the use of a generic type parameter, such as ``, to explicitly define the shape of the objects within the dataset passed to the paginator, ensuring type correctness and improved developer experience. ```typescript import { EasyPaginator } from 'slack-block-builder'; const paginator = EasyPaginator(params); const blocks = paginator.getBlocks(); ``` -------------------------------- ### Applying Inline Conditional Helpers in a Slack Modal with JavaScript Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/other/conditionals.md Illustrates the practical application of `setIfTruthy` within a Slack Modal. This example dynamically adds an input block for group members and enables the 'Save Changes' button only if a `selectedGroup` is present, showcasing how to conditionally render UI components and actions. ```javascript import { Modal, Blocks, Elements, Bits, setIfTruthy } from 'slack-block-builder'; export default ({ groups, selectedGroup, selectedGroupMembers }) => Modal() .title('Edit Groups') .callbackId('submit-edit-groups') .blocks( Blocks.Section({ text: 'Hello! Need to edit some groups?'}), Blocks.Input({ label: 'Select a group to get started' }) .dispatchAction() .element( Elements.StaticSelect({ placeholder: 'Select a group...' }) .actionId('selectedGroup') .options(groups .map(({ name, id }) => Bits.Option({ text: name, value: id })))), setIfTruthy(selectedGroup, [ Blocks.Input({ label: 'Current group members' }) .element( Elements.UserMultiSelect({ placeholder: 'Select members...' }) .actionId('groupMembers') .initialUsers(selectedGroupMembers)) ])) .submit(setIfTruthy(selectedGroup, 'Save Changes')) .buildToJSON(); ``` -------------------------------- ### ContextBuilder.blockId() Setter Method Example Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/blocks/context.md This method sets a unique string identifier for the context block. The `blockId` is crucial for identifying the block in interaction payloads and view submissions, allowing your application to process user interactions effectively. It returns the `ContextBuilder` instance, supporting method chaining. ```javascript ContextBuilder.blockId(string); ``` -------------------------------- ### NumberInputBuilder Constructor Parameters Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/elements/number-input.md Describes the optional parameters that can be passed directly to the `NumberInputBuilder` constructor for initial property assignment. These parameters correspond to chainable setter methods. ```APIDOC actionId: String - Identifier for the action taken by the user. ``` ```APIDOC initialValue: Int - Pre-populates the input with a default value. ``` ```APIDOC isDecimalAllowed: boolean - Dictates whether a decimal is allowed for the value entered into the number input. ``` ```APIDOC minValue: Int - Sets a minimum value for the number input. ``` ```APIDOC maxValue: Int - Sets a maximum value for the number input. ``` ```APIDOC placeholder: String - Defines the text displayed as a placeholder in the empty input element. ``` -------------------------------- ### ContextBuilder.elements() Setter Method Example Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/blocks/context.md This method is used to add one or more elements to the context block. It accepts an array of `Element` objects, which define the content within the block. Like all setter methods, it returns the `ContextBuilder` instance itself, enabling method chaining for fluent API usage. ```javascript ContextBuilder.elements([Element1[, ...[, ElementN]]); ``` -------------------------------- ### Instantiate ImageBuilder in JavaScript Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/blocks/image.md Demonstrates two common methods for creating a new `ImageBuilder` instance using the `slack-block-builder` library: direct import of `Image` or accessing it via the `Blocks` category. Both methods accept optional parameters. ```javascript import { Image } from 'slack-block-builder'; const myObj = Image(params?); ``` ```javascript import { Blocks } from 'slack-block-builder'; const myObj = Blocks.Image(params?); ``` -------------------------------- ### Creating a ContextBuilder Instance Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/blocks/context.md This snippet demonstrates how to create a new instance of the `ContextBuilder` object. It shows two common methods: importing `Context` directly as a top-level function, or accessing it as a member of the `Blocks` category. Both approaches achieve the same result, allowing you to begin building a Slack context block. ```javascript import { Context } from 'slack-block-builder'; const myObj = Context(params?); ``` ```javascript import { Blocks } from 'slack-block-builder'; const myObj = Blocks.Context(params?); ``` -------------------------------- ### VideoBuilder Constructor Parameters (APIDOC) Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/blocks/video.md This section lists the primitive properties that can optionally be passed as parameters when instantiating a `VideoBuilder` object. These parameters correspond to the object's chainable setter methods, providing an alternative for initial property assignment. ```APIDOC VideoBuilder(params?): altText: String blockId: String description: String providerIconUrl: String providerName: String thumbnailUrl: String title: String titleUrl: String videoUrl: String ``` -------------------------------- ### OptionBuilder Constructor Parameters Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/bits/option.md Lists the primitive value properties that can optionally be passed directly to the `OptionBuilder` instantiating function. ```APIDOC description – *String* text – *String* url – *String* value – *String* ``` -------------------------------- ### Creating an OptionGroupBuilder Instance (JavaScript) Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/bits/option-group.md Demonstrates two methods for instantiating `OptionGroupBuilder` in JavaScript: direct import and via the `Bits` category, allowing for flexible integration into Slack Block Builder projects. ```javascript import { OptionGroup } from 'slack-block-builder'; const myObj = OptionGroup(params?); ``` ```javascript import { Bits } from 'slack-block-builder'; const myObj = Bits.OptionGroup(params?); ``` -------------------------------- ### Returning Option Group Collection for External Select Menus Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/other/option-group-collection.md This example shows how to use `OptionGroupCollection` to format the response for select menus that use external data sources. The function's output is passed into the `options` property of the return object, providing the necessary structure for Slack's Block Kit. ```javascript return { options: OptionGroupCollection( /* Pass in option groups */ ) }; ``` -------------------------------- ### Creating an AttachmentBuilder Instance Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/bits/attachment.md Demonstrates how to create a new instance of `AttachmentBuilder` using either a top-level import or as a member of the `Bits` category. ```javascript import { Attachment } from 'slack-block-builder'; const myObj = Attachment(params?); ``` ```javascript import { Bits } from 'slack-block-builder'; const myObj = Bits.Attachment(params?); ``` -------------------------------- ### Configure Slack Block Builder Elements with Optional Arguments in JavaScript Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/announcements/version-2.md Demonstrates how builder methods like Button.danger() and Button.primary() now accept optional boolean arguments. This allows for dynamic application of styles based on logic, as shown in a Slack message example where a button's danger state is conditional. ```javascript import { Message, Blocks, Elements } from 'slack-block-builder'; const myShorterMessage = ({ channel, dangerLevel }) => { return Message({ channel, text: 'Alas, my friend.' }) .blocks( Blocks.Section({ text: 'One does not simply walk into Slack and click a button.' }), Blocks.Section({ text: 'At least that\'s what my friend Slackomir said :crossed_swords:' }), Blocks.Divider(), Blocks.Actions() .elements( Elements.Button({ text: 'Sure One Does', actionId: 'gotClicked' }) .danger(dangerLevel > 42), // Optional argument, defaults to 'true' Elements.Button({ text: 'One Does Not', actionId: 'scaredyCat' }) .primary())) .asUser() .buildToObject(); }; ``` -------------------------------- ### Paginator Component Instantiation Methods Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/components/paginator.md These snippets demonstrate the two primary ways to instantiate the Paginator component: directly importing it or accessing it via the `Components` object, both followed by calling `getBlocks()` to retrieve the generated Slack blocks. ```javascript import { Paginator } from 'slack-block-builder'; const paginator = Paginator(params); const blocks = paginator.getBlocks(); ``` ```javascript import { Components } from 'slack-block-builder'; const paginator = Components.Paginator(params); const blocks = paginator.getBlocks(); ``` -------------------------------- ### Format Slack Message Text with Markdown Helpers in JavaScript Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/announcements/version-2.md Demonstrates how to use the Md helper functions provided by Slack Block Builder Version 2 to declaratively format text using Slack's markdown standard. Examples include formatting user mentions, italic text, inline code, and bulleted lists within a Slack message. ```javascript import { Message, Blocks, Md } from 'slack-block-builder'; const myMdMessage = ({ channel, user }) => { const slashCommands = ['/schedule', '/cancel', '/remind', '/help']; return Message({ channel, text: 'Alas, my friend.' }) .blocks( Blocks.Section({ text: `:wave: Hi there, ${Md.user(user)}!` }), Blocks.Section({ text: `${Md.italic('Sorry')}, I didn't get that. Why don't you try out some of my slash commands?` }), Blocks.Section({ text: `Here are some of the things that I can do:` }), Blocks.Section() .text(Md.listBullet(slashCommands .map((item) => Md.codeInline(item))))) .asUser() .buildToObject(); }; ``` -------------------------------- ### Instantiating WorkflowStepBuilder in JavaScript Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/surfaces/workflow-step.md Demonstrates two ways to create a new instance of the `WorkflowStepBuilder` object: directly importing `WorkflowStep` or accessing it via the `Surfaces` category. Both methods allow optional parameters during instantiation. ```javascript import { WorkflowStep } from 'slack-block-builder'; const myObj = WorkflowStep(params?); ``` ```javascript import { Surfaces } from 'slack-block-builder'; const myObj = Surfaces.WorkflowStep(params?); ``` -------------------------------- ### EmailInputBuilder API Reference Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/elements/email-input.md Comprehensive API documentation for the `EmailInputBuilder` object, detailing its constructor parameters and chainable setter methods for configuring email input elements in Slack Block Kit. ```APIDOC EmailInputBuilder: Constructor Parameters: actionId: string initialValue: string placeholder: string Methods: dispatchActionOnCharacterEntered(boolean?): this Description: Instructs the Slack API to dispatch an interaction payload to your app when the user enters or deletes a character in the input. Defaults to true. dispatchActionOnEnterPressed(boolean?): this Description: Instructs the Slack API to dispatch an interaction payload to your app when the user presses the enter key while the input is in focus. Defaults to true. focusOnLoad(boolean?): this Description: Sets an element to have auto focus on opening the view. Defaults to true. actionId(string): this Description: Sets a string to be an identifier for the action taken by the user. It is sent back to your app in the interaction payload when the element is interacted or when the view is submitted. initialValue(string): this Description: Pre-populates the input with a default value. placeholder(string): this Description: Defines the text displayed as a placeholder in the empty input element. end(): this Description: Performs no alterations to the object on which it is called. It is meant to simulate a closing HTML tag for those who prefer to have an explicit end declared for an object. ``` -------------------------------- ### Create EmailInputBuilder Instances in JavaScript Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/elements/email-input.md Demonstrates two ways to instantiate the `EmailInputBuilder` object: via direct import of `EmailInput` or through the `Elements` category, allowing for flexible integration into Slack Block Kit applications. ```javascript import { EmailInput } from 'slack-block-builder'; const myObj = EmailInput(params?); ``` ```javascript import { Elements } from 'slack-block-builder'; const myObj = Elements.EmailInput(params?); ``` -------------------------------- ### OptionBuilder Chainable Setter Methods Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/bits/option.md Details the chainable setter methods available on the `OptionBuilder` object, each returning the instance itself for method chaining. ```APIDOC OptionBuilder.description(string); Sets the descriptive text displayed below the text field of the option or for a video, if creating a Video block. OptionBuilder.text(string); Sets the text displayed for buttons, headers, confirmation dialogs, sections, context blocks, and options. OptionBuilder.url(string); Sets the URL to which the user is redirected when interacting with a button or option. OptionBuilder.value(string); Sets a value to be sent to your app when a user interacts with a button or option. ``` -------------------------------- ### Instantiate Static Multi-Select Builder Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/elements/static-multi-select.md Demonstrates how to create a new instance of `StaticMultiSelectBuilder` using either a top-level import or by accessing it through the `Elements` category, with an optional `params` object for initial property values. ```javascript import { StaticMultiSelect } from 'slack-block-builder'; const myObj = StaticMultiSelect(params?); ``` ```javascript import { Elements } from 'slack-block-builder'; const myObj = Elements.StaticMultiSelect(params?); ``` -------------------------------- ### StaticSelectBuilder Constructor Parameters Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/elements/static-select.md These are the optional primitive parameters that can be passed directly to the `StaticSelectBuilder` constructor during instantiation. For a detailed explanation of each parameter, refer to its corresponding setter method documentation. ```APIDOC StaticSelectBuilder Constructor Parameters: - actionId: String - placeholder: String ``` -------------------------------- ### HomeTabBuilder.getPreviewUrl() Method Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/surfaces/home-tab.md Builds the Home Tab view and generates a preview URL, which can be used to open and visualize the view in Slack's Block Kit Builder web application. ```javascript HomeTabBuilder.getPreviewUrl(); ``` -------------------------------- ### Creating DateTimePickerBuilder Instance Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/elements/date-time-picker.md Demonstrates two ways to import and instantiate the `DateTimePickerBuilder` object from the 'slack-block-builder' library: as a top-level import or as a member of the 'Elements' category. ```javascript import { DateTimePicker } from 'slack-block-builder'; const myObj = DateTimePicker(params?); ``` ```javascript import { Elements } from 'slack-block-builder'; const myObj = Elements.DateTimePicker(params?); ``` -------------------------------- ### TextInputBuilder Object API Reference Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/elements/text-input.md Comprehensive API documentation for the `TextInputBuilder` object, including its constructor parameters, chainable setter methods, and other utility methods. All setter methods return the instance of `TextInputBuilder` for method chaining. ```APIDOC TextInputBuilder: Instantiation: TextInput(params?) Elements.TextInput(params?) Parameters (for instantiation): actionId: String - An identifier for the action taken by the user. Sent back in interaction payload. initialValue: String - Pre-populates the input with a default value. multiline: boolean - Sets the text input to be a larger, multi-line input. maxLength: Int - Sets a maximum character count allowed. minLength: Int - Sets a minimum character count required before submission. placeholder: String - Defines the text displayed as a placeholder in the empty input element. Setter Methods (all return TextInputBuilder instance): dispatchActionOnCharacterEntered(boolean?): Description: Instructs the Slack API to dispatch an interaction payload to your app when the user enters or deletes a character in the input. Defaults to true. dispatchActionOnEnterPressed(boolean?): Description: Instructs the Slack API to dispatch an interaction payload to your app when the user presses the enter key while the input is in focus. Defaults to true. focusOnLoad(boolean?): Description: Sets an element to have auto focus on opening the view. Defaults to true. multiline(boolean?): Description: Sets the text input to be a larger, multi-line input for larger portions of text. Defaults to true. actionId(string): Description: Sets a string to be an identifier for the action taken by the user. It is sent back to your app in the interaction payload when the element is interacted or when the view is submitted. initialValue(string): Description: Pre-populates the input with a default value. maxLength(int): Description: Sets a maximum character count allowed in the given text input. minLength(int): Description: Sets a minimum character count required for the given text input before the user can submit the view. placeholder(string): Description: Defines the text displayed as a placeholder in the empty input element. Other Methods: end(): Description: Performs no alterations to the object on which it is called. It is meant to simulate a closing HTML tag for those who prefer to have an explicit end declared for an object. ``` -------------------------------- ### Access Home Tab Surface Component Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/support.md Provides access to the Home Tab Surface component within the Block Builder library, supporting Slack Block Kit integration. ```APIDOC HomeTab() ``` -------------------------------- ### ImgBuilder Constructor Parameters Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/elements/img.md Details the optional primitive parameters that can be passed directly to the `ImgBuilder` constructor during instantiation, serving as initial property values. ```APIDOC ImgBuilder: __init__(params?) params: imageUrl: String - The source URL for the image block or element. altText: String - A plain-text summary of the image element or block. ``` -------------------------------- ### ConfirmationDialogBuilder Constructor Parameters Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/bits/confirmation-dialog.md Lists the primitive value parameters that can be optionally passed directly to the `ConfirmationDialogBuilder` instantiating function. These parameters correspond to chainable setter methods for configuring the dialog's properties. ```APIDOC ConfirmationDialogBuilder Constructor Parameters: - confirm: String - deny: String - text: String - title: String ``` -------------------------------- ### FileBuilder Object API Reference Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/blocks/file.md Comprehensive API documentation for the `FileBuilder` object, including its constructor parameters and chainable setter methods. ```APIDOC FileBuilder: __init__(params?) params: blockId: String externalId: String Methods: blockId(string): this string: An identifier for any given block in a view or message. This is sent back to your app in interaction payloads and view submissions for your app to process. externalId(string): this string: A custom identifier for a view or file that must be unique for all views on a per-team basis. end(): this Performs no alterations to the object on which it is called. It is meant to simulate a closing HTML tag for those who prefer to have an explicit end declared for an object. ``` -------------------------------- ### TimePickerBuilder Instantiation Parameters Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/elements/timepicker.md Lists the primitive parameters that can optionally be passed directly to the `TimePickerBuilder` instantiating function for initial configuration. ```APIDOC TimePickerBuilder Parameters: actionId: String initialTime: String placeholder: String ``` -------------------------------- ### Create ChannelMultiSelectBuilder Instances (JavaScript) Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/elements/channel-multi-select.md Demonstrates how to create a new instance of `ChannelMultiSelectBuilder` using either a top-level import or by accessing it as a member of the `Elements` category from the 'slack-block-builder' library. Both methods achieve the same result of instantiating the builder object. ```javascript import { ChannelMultiSelect } from 'slack-block-builder'; const myObj = ChannelMultiSelect(params?); ``` ```javascript import { Elements } from 'slack-block-builder'; const myObj = Elements.ChannelMultiSelect(params?); ``` -------------------------------- ### ChannelSelectBuilder Constructor Parameters Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/elements/channel-select.md Lists the primitive properties that can optionally be passed to the `ChannelSelectBuilder` instantiating function. ```APIDOC ChannelSelectBuilder(params?): params: actionId: String initialChannel: String placeholder: String ``` -------------------------------- ### HomeTabBuilder Constructor Parameters Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/surfaces/home-tab.md Describes the optional primitive value parameters that can be passed directly to the HomeTabBuilder instantiating function. ```APIDOC HomeTabBuilder(params?): privateMetaData: String callbackId: String externalId: String ``` -------------------------------- ### WorkflowStepBuilder.getPreviewUrl Method Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/surfaces/workflow-step.md Constructs the workflow step view and returns a URL that can be used to preview the view in Slack's Block Kit Builder web application. ```APIDOC WorkflowStepBuilder.getPreviewUrl(): Returns: String - A URL to preview the view on Slack's Block Kit Builder. ``` -------------------------------- ### APIDOC: URLInputBuilder Constructor Parameters Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/elements/url-input.md Documents the optional primitive parameters that can be passed directly to the `URLInputBuilder` constructor. These parameters correspond to properties that can also be set via chainable setter methods. ```APIDOC URLInputBuilder Constructor Parameters: actionId: String - An identifier for the action taken by the user. It is sent back to your app in the interaction payload when the element is interacted or when the view is submitted. initialValue: String - Pre-populates the input with a default value. placeholder: String - Defines the text displayed as a placeholder in the empty input element. ``` -------------------------------- ### ButtonBuilder Constructor Parameters API Reference Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/elements/button.md This section outlines the primitive properties that can be optionally provided as arguments when instantiating a `ButtonBuilder` object. These parameters directly correspond to the object's chainable setter methods, allowing for initial configuration. ```APIDOC ButtonBuilder Parameters: accessibilityLabel: String actionId: String text: String url: String value: String ``` -------------------------------- ### JavaScript: Import URLInput directly Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/elements/url-input.md Demonstrates how to import the `URLInput` function directly from `slack-block-builder` to create a new instance of `URLInputBuilder`. Optional parameters can be passed during instantiation. ```javascript import { URLInput } from 'slack-block-builder'; const myObj = URLInput(params?); ``` -------------------------------- ### Creating FileInputBuilder Instances in JavaScript Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/elements/file-input.md Demonstrates two ways to create a new instance of `FileInputBuilder` using `slack-block-builder`: as a top-level import or as a member of the `Elements` category. Both methods can optionally accept parameters. ```javascript import { FileInput } from 'slack-block-builder'; const myObj = FileInput(params?); ``` ```javascript import { Elements } from 'slack-block-builder'; const myObj = Elements.FileInput(params?); ``` -------------------------------- ### Instantiating VideoBuilder in JavaScript Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/blocks/video.md This snippet demonstrates two common ways to create a new instance of the `VideoBuilder` object using the `slack-block-builder` library. You can either import `Video` directly as a top-level function or access it as a member of the `Blocks` category. ```javascript import { Video } from 'slack-block-builder'; const myObj = Video(params?); ``` ```javascript import { Blocks } from 'slack-block-builder'; const myObj = Blocks.Video(params?); ``` -------------------------------- ### DatePickerBuilder Constructor Parameters (APIDOC) Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/elements/date-picker.md Describes the optional primitive parameters that can be passed directly to the `DatePickerBuilder` constructor function. These parameters allow for initial configuration of the date picker's properties. ```APIDOC DatePickerBuilder(params?): actionId: String initialDate: Date placeholder: String ``` -------------------------------- ### Creating ImgBuilder Instances in JavaScript Source: https://github.com/raycharius/slack-block-builder/blob/main/docs/elements/img.md Illustrates two methods for instantiating the `ImgBuilder` object from the `slack-block-builder` library: direct import of `Img` or accessing it via the `Elements` category. ```javascript import { Img } from 'slack-block-builder'; const myObj = Img(params?); ``` ```javascript import { Elements } from 'slack-block-builder'; const myObj = Elements.Img(params?); ```