{"id":23711375,"url":"https://github.com/springrole/teams-view-builder","last_synced_at":"2026-02-07T21:30:18.353Z","repository":{"id":41837075,"uuid":"464743371","full_name":"SpringRole/teams-view-builder","owner":"SpringRole","description":"Teams view builder provides reusable common components that can be used to build views for messages and modals for Microsoft Teams bot","archived":false,"fork":false,"pushed_at":"2022-06-04T08:44:42.000Z","size":35,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-02-16T17:55:14.499Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SpringRole.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-03-01T04:29:09.000Z","updated_at":"2022-05-27T08:52:08.000Z","dependencies_parsed_at":"2022-08-11T19:01:16.857Z","dependency_job_id":null,"html_url":"https://github.com/SpringRole/teams-view-builder","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpringRole%2Fteams-view-builder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpringRole%2Fteams-view-builder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpringRole%2Fteams-view-builder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpringRole%2Fteams-view-builder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SpringRole","download_url":"https://codeload.github.com/SpringRole/teams-view-builder/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239800427,"owners_count":19699122,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-30T19:49:28.464Z","updated_at":"2026-02-07T21:30:18.288Z","avatar_url":"https://github.com/SpringRole.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @springrole/teams-view-builder\n\n## Getting started\n\nThis is a simple package that can be used to create the blocks and views required to interact with users on any Microsoft Teams Application.\n\n### Installation\n\n```console\n npm install --save @springrole/teams-view-builder\n```\n\n---\n\n### Usage\n\n#### Render a Text Block in an adaptive card\n\n```javascript\nconst TeamsViewBuilder = require(\"@springrole/teams-view-builder\");\n\nrenderTextBlock() {\n    const body = [\n        TeamsViewBuilder.Elements.textBlock({\n            text: \"Hello World!\",\n        })\n    ]\n    return TeamsViewBuilder.Cards.adaptiveCard({\n        body\n    })\n}\n\n// OR\n\nconst { Elements, Cards } = require(\"@springrole/teams-view-builder\");\n\nrenderTextBlock() {\n    const body = [\n        Elements.textBlock({\n            text: \"Hello World!\",\n        })\n    ]\n    return Cards.adaptiveCard({\n        body\n    })\n}\n```\n\n#### Render an Image in an adaptive card\n\n```javascript\nconst TeamsViewBuilder = require(\"@springrole/teams-view-builder\");\n\nrenderImage() {\n    const body = [\n        TeamsViewBuilder.Elements.image({\n            url: \"https://pbs.twimg.com/profile_images/3647943215/d7f12830b3c17a5a9e4afcc370e3a37e_400x400.jpeg\",\n            altText: \"Matt Hidinger\",\n            size: TeamsViewBuilder.Elements.ImageSizes.small\n        })\n    ]\n    return TeamsViewBuilder.Cards.adaptiveCard({\n        body\n    })\n}\n```\n\n#### Render a ColumnSet in an adaptive card\n\n```javascript\nconst TeamsViewBuilder = require(\"@springrole/teams-view-builder\");\n\nrenderColumnSet() {\n    const body = [\n        TeamsViewBuilder.Containers.columnSet({\n            columns: [\n                TeamsViewBuilder.Containers.column({\n                    items: [\n                        TeamsViewBuilder.Elements.textBlock({\n                            text: \"Hello World!\",\n                        })\n                    ]\n                }),\n                TeamsViewBuilder.Containers.column({\n                    items: [\n                        TeamsViewBuilder.Elements.image({\n                            url: \"https://pbs.twimg.com/profile_images/3647943215/d7f12830b3c17a5a9e4afcc370e3a37e_400x400.jpeg\",\n                            altText: \"Matt Hidinger\",\n                            size: TeamsViewBuilder.Elements.ImageSizes.small\n                        })\n                    ]\n                })\n            ]\n        })\n    ]\n    return TeamsViewBuilder.Cards.adaptiveCard({\n        body\n    })\n}\n```\n\n#### Tag a user in the text block of an adaptive card\n\n```javascript\nconst TeamsViewBuilder = require(\"@springrole/teams-view-builder\");\n\ntagUserInTextBlock(userName, userId) {\n    const body = [\n        TeamsViewBuilder.Elements.textBlock({\n            text: `Hello \u003c@${userName}\u003e`,\n        })\n    ]\n    return TeamsViewBuilder.Cards.adaptiveCard({\n        body,\n        entities: [\n            TeamsViewBuilder.Entity.tag(userName, userId)\n        ]\n    })\n}\n\n// OR\n\ntagUserInTextBlock(userName, userId) {\n    const body = [\n        TeamsViewBuilder.Elements.textBlock({\n            text: `Hello ${TeamsViewBuilder.Entity.tagify(userName)}`,\n        })\n    ]\n    return TeamsViewBuilder.Cards.adaptiveCard({\n        body,\n        entities: [\n            TeamsViewBuilder.Entity.tag(userName, userId)\n        ]\n    })\n}\n```\n\n#### Render a Text Block with Action Buttons in an adaptive card\n\n```javascript\nconst TeamsViewBuilder = require(\"@springrole/teams-view-builder\");\n\nrenderTextBlockWithActions() {\n    const body = [\n        TeamsViewBuilder.Elements.textBlock({\n            text: \"Hello World!\",\n        })\n    ]\n\n    const actions = [\n        TeamsViewBuilder.Actions.submit({\n            title: \"Cancel\",\n            style: TeamsViewBuilder.Actions.ActionStyles.danger,\n            data: {\n                value: 'Cancel'\n            }\n        }),\n        TeamsViewBuilder.Actions.openUrl({\n            title: \"Open Link\",\n            style: TeamsViewBuilder.Actions.ActionStyles.primary,\n            url: \"https://teams.microsoft.com/l/entity/ABCDE-12345-SAMPLE/tab\"\n        })\n    ]\n\n    return TeamsViewBuilder.Cards.adaptiveCard({\n        body,\n        actions\n    })\n}\n\n// OR\n\nrenderTextBlockWithActions() {\n    const body = [\n        TeamsViewBuilder.Elements.textBlock({\n            text: \"Hello World!\",\n        }),\n        TeamsViewBuilder.Containers.actionSet({\n            actions: [\n                TeamsViewBuilder.Actions.submit({\n                    title: \"Cancel\",\n                    style: TeamsViewBuilder.Actions.ActionStyles.danger,\n                    data: {\n                        value: 'Cancel'\n                    }\n                }),\n                TeamsViewBuilder.Actions.openUrl({\n                    title: \"Open Link\",\n                    style: TeamsViewBuilder.Actions.ActionStyles.primary,\n                    url: \"https://teams.microsoft.com/l/entity/ABCDE-12345-SAMPLE/tab\"\n                })\n            ]\n        })\n    ]\n    return TeamsViewBuilder.Cards.adaptiveCard({\n        body\n    })\n}\n```\n\n#### Render Select Dropdown in an adaptive card\n\n```javascript\nconst TeamsViewBuilder = require(\"@springrole/teams-view-builder\");\n\nrenderSelectDropDown() {\n    const choices = [\n        TeamsViewBuilder.Input.choice({\n            title: \"choice 1\",\n            value: \"1\"\n        }),\n        TeamsViewBuilder.Input.choice({\n            title: \"choice 2\",\n            value: \"2\"\n        })\n    ]\n\n    const body = [\n        TeamsViewBuilder.Input.select({\n            choices,\n            placeholder: 'Select a value',\n            wrap: true,\n            spacing: TeamsViewBuilder.Input.Spacing.small,\n            value: 'value',\n            id: 'selectDropDown'\n        })\n    ]\n\n    return TeamsViewBuilder.Cards.adaptiveCard({\n        body\n    })\n}\n```\n\n---\n\n### License\n\n@springrole/teams-view-builder is licensed under the [MIT License](https://github.com/SpringRole/teams-view-builder/blob/main/LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspringrole%2Fteams-view-builder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspringrole%2Fteams-view-builder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspringrole%2Fteams-view-builder/lists"}