Class Carousel
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
ภาพหมุน
ภาพสไลด์หรือที่เรียกว่าแถบเลื่อนจะหมุนและแสดงรายการวิดเจ็ตในรูปแบบสไลด์โชว์ โดยมีปุ่มไปยังวิดเจ็ตก่อนหน้าหรือถัดไป
พร้อมใช้งานสำหรับส่วนเสริมของ Google Workspace และแอป Google Chat
const carousel =
CardService.newCarousel()
.addCarouselCard(CardService.newCarouselCard().addWidget(
CardService.newTextParagraph().setText('The first text paragraph in carousel')))
.addCarouselCard(CardService.newCarouselCard().addWidget(
CardService.newTextParagraph().setText('The second text paragraph in carousel')))
.addCarouselCard(CardService.newCarouselCard().addWidget(
CardService.newTextParagraph().setText('The third text paragraph in carousel')))
เอกสารประกอบโดยละเอียด
addCarouselCard(card)
เพิ่มการ์ดภาพสไลด์
const carousel =
CardService.newCarousel()
.addCarouselCard(CardService.newCarouselCard().addWidget(
CardService.newTextParagraph().setText('The first text paragraph in carousel')));
พารามิเตอร์
รีเทิร์น
Carousel
— ออบเจ็กต์นี้สําหรับการต่อเชื่อม
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-26 UTC
[null,null,["อัปเดตล่าสุด 2025-07-26 UTC"],[[["\u003cp\u003eCarousel, also known as a slider, displays widgets in a rotating slideshow format with navigation buttons.\u003c/p\u003e\n"],["\u003cp\u003eCarousels are available for use in Google Workspace add-ons and Google Chat apps.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eaddCarouselCard(card)\u003c/code\u003e method is used to add a carousel card to the carousel, and it returns the Carousel object for chaining.\u003c/p\u003e\n"],["\u003cp\u003eCarousels are currently part of the Google Workspace Developer Preview Program, providing early access to this feature.\u003c/p\u003e\n"]]],["Carousel, or slider, displays widgets in a slideshow format, navigable via buttons. It's available for Google Workspace add-ons and Google Chat apps. Developers use `CardService.newCarousel()` to create it. `addCarouselCard(card)` method adds individual cards, such as text paragraphs, to the carousel. Each card can be created using `CardService.newCarouselCard()`. This method returns the Carousel object, allowing for chaining of card additions. This is available in the Google Workspace Developer Preview Program.\n"],null,["# Class Carousel\n\nCarousel\n\nCarousel, also known as slider, rotates and displays a list of widgets in a slideshow format,\nwith buttons navigating to the previous or next widget.\n\nAvailable for Google Workspace add-ons and Google Chat apps.\n\n```javascript\nconst carousel =\n CardService.newCarousel()\n .addCarouselCard(CardService.newCarouselCard().addWidget(\n CardService.newTextParagraph().setText('The first text paragraph in carousel')))\n .addCarouselCard(CardService.newCarouselCard().addWidget(\n CardService.newTextParagraph().setText('The second text paragraph in carousel')))\n .addCarouselCard(CardService.newCarouselCard().addWidget(\n CardService.newTextParagraph().setText('The third text paragraph in carousel')))\n```\n\n\n| **Developer Preview:** Available as part of the [Google Workspace Developer Preview Program](https://developers.google.com/workspace/preview), which grants early access to certain features.\n\n\u003cbr /\u003e\n\n### Methods\n\n| Method | Return type | Brief description |\n|---------------------------------------------------------|---------------|-----------------------|\n| [addCarouselCard(card)](#addCarouselCard(CarouselCard)) | [Carousel](#) | Adds a carousel card. |\n\nDetailed documentation\n----------------------\n\n### `add``Carousel``Card(card)`\n\nAdds a carousel card.\n\n```javascript\nconst carousel =\n CardService.newCarousel()\n .addCarouselCard(CardService.newCarouselCard().addWidget(\n CardService.newTextParagraph().setText('The first text paragraph in carousel')));\n```\n\n#### Parameters\n\n| Name | Type | Description |\n|--------|-------------------------------------------------------------------|---------------------------|\n| `card` | [CarouselCard](/apps-script/reference/card-service/carousel-card) | The carousel card to add. |\n\n#### Return\n\n\n[Carousel](#) --- This object, for chaining."]]