Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Tiện ích bổ sung của Google Workspace trình bày thông tin và các chế độ kiểm soát người dùng trong thanh bên của giao diện người dùng ứng dụng lưu trữ. Tiện ích bổ sung bao gồm một thanh công cụ nhận dạng chính cùng với một hoặc nhiều thẻ.
Mỗi thẻ đại diện cho một "trang" cụ thể trong giao diện người dùng của tiện ích bổ sung và việc chuyển đến một thẻ mới thường chỉ là vấn đề tạo thẻ đó và đẩy thẻ đó vào một ngăn xếp thẻ nội bộ.
Bạn có thể xác định luồng điều hướng giữa các thẻ để có trải nghiệm tương tác phong phú.
Thẻ có thể là không theo ngữ cảnh hoặc theo ngữ cảnh. Thẻ theo ngữ cảnh sẽ xuất hiện với người dùng khi ứng dụng lưu trữ ở trong một ngữ cảnh cụ thể. Ví dụ: khi mở thư trong Gmail hoặc sự kiện trên Lịch. Thẻ không theo ngữ cảnh (chẳng hạn như trang chủ) được trình bày cho người dùng bên ngoài một ngữ cảnh cụ thể của máy chủ lưu trữ. Ví dụ: khi người dùng đang xem hộp thư đến trong Gmail, thư mục chính trong Drive hoặc Lịch.
Tiện ích bổ sung Google Workspace được tạo trong Apps Script sử dụng Dịch vụ thẻ để tạo giao diện người dùng từ thẻ. Tiện ích bổ sung được tạo bằng các ngôn ngữ khác phải trả về JSON có định dạng phù hợp để giao diện hiển thị dưới dạng thẻ.
Mỗi thẻ bao gồm một tiêu đề và một hoặc nhiều phần thẻ. Mỗi phần bao gồm một nhóm tiện ích. Tiện ích hiển thị thông tin cho người dùng hoặc cung cấp các chế độ kiểm soát tương tác như nút.
Giao diện dựa trên thẻ có những lợi ích sau:
Bạn không cần có kiến thức về HTML hoặc CSS để tạo giao diện dựa trên thẻ.
Các thẻ và tiện ích sẽ tự động được tạo kiểu để hoạt động hiệu quả với các ứng dụng Google Workspace mà chúng mở rộng.
Giao diện dựa trên thẻ hoạt động trên cả máy tính và thiết bị di động, nhưng bạn chỉ cần xác định giao diện một lần.
Tạo giao diện dựa trên thẻ
Khi tạo các tiện ích bổ sung dựa trên thẻ, bạn cần hiểu rõ một số khái niệm và mẫu thiết kế nhất định. Các hướng dẫn sau đây cung cấp thông tin bạn cần để tạo các tiện ích bổ sung dựa trên thẻ hiệu quả:
Tham khảo các trang này khi tạo thẻ và triển khai hành vi của giao diện người dùng. Bạn cũng có thể tham khảo các mẫu bổ sung sau đây khi triển khai tiện ích bổ sung:
Mẫu tiện ích bổ sung này cho thấy một tiện ích bổ sung của Google Workspace cho phép người dùng dịch văn bản trong Tài liệu, Trang tính và Trang trình bày.
Mẫu tiện ích bổ sung này cho thấy một mẫu tiện ích bổ sung phức tạp hơn của Google Workspace, mẫu này cho thấy thông tin người dùng về người nhận thư Gmail, người chỉnh sửa tệp trên Drive hoặc người tham dự sự kiện trên Lịch. Bạn chỉ có thể sử dụng tiện ích bổ sung này trong một miền, vì tiện ích này sử dụng Directory API để truy xuất thông tin người dùng.
[null,null,["Cập nhật lần gần đây nhất: 2025-08-04 UTC."],[[["\u003cp\u003eGoogle Workspace add-ons use cards to build user interfaces within the host application's sidebar, offering navigation and interactive elements.\u003c/p\u003e\n"],["\u003cp\u003eCards can be contextual, appearing in specific situations like opening an email, or non-contextual, like when viewing your inbox.\u003c/p\u003e\n"],["\u003cp\u003eCard-based interfaces are built using cards, widgets, and actions, offering a structured way to present information and controls.\u003c/p\u003e\n"],["\u003cp\u003eAdd-ons built with Apps Script utilize the Card service, while other languages require formatted JSON for card rendering.\u003c/p\u003e\n"],["\u003cp\u003eThese interfaces are automatically styled, responsive across devices, and require no HTML/CSS knowledge for basic creation.\u003c/p\u003e\n"]]],["Google Workspace add-ons utilize card-based UIs within host applications, comprising a toolbar and multiple cards. These cards, representing UI pages, are built using the Card service or JSON. Navigation involves pushing new cards onto a stack. Cards can be contextual, appearing in specific host application states, or non-contextual, like homepages, visible in general views. Each card contains sections composed of widgets, offering information or interaction controls. Key actions include defining card navigation, constructing cards with sections and widgets, and implementing actions.\n"],null,["# Card-based interfaces\n\n| **Note:** Google Workspace add-ons are card-based. Editor add-ons are [HTML-based](/workspace/add-ons/concepts/html-interfaces).\n\nGoogle Workspace add-ons present information and user\ncontrols in the sidebar of the\n[host application](/workspace/add-ons/guides/glossary#host_or_host_application)\nUI. An add-on consists of a main identifying toolbar along with one or more\n[cards](/workspace/add-ons/concepts/cards).\n\nEach card represents a particular 'page' of your add-on's UI, and\n[navigating to a new card](/workspace/gmail/add-ons/how-tos/navigation) is\nusually just a matter of creating that card and\n[pushing it onto an internal card stack](/workspace/gmail/add-ons/how-tos/navigation#navigation_methods).\nYou can define navigation flows between cards for a rich interaction experience.\n\nCards can be *non-contextual* or *contextual* . Contextual cards are presented\nto the user when the host application is in a specific context. For example,\nwhen opening a Gmail message or Calendar event. Non-contextual cards (such as\n[homepages](/workspace/add-ons/concepts/homepages)) are presented to the user\noutside of a specific context of the host. For example, when the user is\nviewing their Gmail inbox, main Drive folder, or Calendar.\n\nGoogle Workspace add-ons built in Apps Script use the\n[Card service](/apps-script/reference/card-service/card-service) to create user interfaces out of\n[cards](/workspace/add-ons/concepts/cards). Add-ons built in other languages\nmust return properly formatted JSON for the interface to render as cards.\n\nEach card consists of a header and one or more card sections. Each section is\ncomposed of a set of [widgets](/workspace/add-ons/concepts/widgets). Widgets\ndisplay information to the user or provide interaction controls like buttons.\n\nCard-based interfaces have the following benefits:\n\n- No knowledge of HTML or CSS is needed to create card-based interfaces.\n- Cards and widgets are automatically styled to work well with the Google Workspace applications they extend.\n- Card-based interfaces work on both desktop and mobile devices, but you only\n need to define the interface once.\n\n | **Note:** Gmail is currently the only host application that can be extended by Google Workspace add-ons on mobile.\n\nCreating card-based interfaces\n------------------------------\n\nWhen building card-based add-ons, it's important to understand certain\nconcepts and design patterns. The following guides provide the information\nyou need to build effective card-based add-ons:\n\n- [Cards](/workspace/add-ons/concepts/cards)\n- [Homepages](/workspace/add-ons/concepts/homepages)\n- [Widgets](/workspace/add-ons/concepts/widgets)\n- [Actions](/workspace/add-ons/concepts/actions)\n- [Event objects](/workspace/add-ons/concepts/event-objects)\n- [Constructing cards](/workspace/add-ons/how-tos/building-workspace-addons#constructing_cards)\n- [Building interactive cards](/workspace/add-ons/how-tos/interactions)\n- [Navigating between cards](/workspace/add-ons/how-tos/navigation)\n- [Using universal actions](/workspace/add-ons/how-tos/universal-actions)\n- [Adding autocomplete to text inputs](/workspace/add-ons/how-tos/suggestions)\n- [Accessing user locales and timezones](/workspace/add-ons/how-tos/access-user-locale)\n- [Connecting to non-Google services](/workspace/add-ons/how-tos/non-google-services)\n- [Style guide](/workspace/add-ons/guides/workspace-style)\n- [Best Practices](/workspace/add-ons/guides/workspace-best-practices)\n\nReference these pages when creating cards and implementing\nUI behavior. You may also find the following additional samples useful to\nreference when implementing your add-on:\n\n- [Google Workspace add-on \"Cats\" quickstart](/workspace/add-ons/cats-quickstart)\n\n This add-on sample shows a simple Google Workspace add-on UI with multiple pages and\n homepages.\n- [Google Workspace add-on: \"Translate\"](/workspace/add-ons/translate-addon-sample)\n\n This add-on sample shows a Google Workspace add-on that lets users translate text from\n within Docs, Sheets, and Slides.\n- [Google Workspace add-on: \"Teams List\"](/workspace/add-ons/teams-addon-sample)\n\n This add-on sample shows a more complex\n Google Workspace add-on sample, that shows\n user information about Gmail message recipients, Drive file editors, or\n Calendar event attendees. You can only use this add-on inside a domain, since\n it uses the [Directory API](/workspace/admin/directory) to retrieve\n user information."]]