Class Columns
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
열
Columns
위젯은 카드 또는 대화상자에 최대 2개의 열을 표시합니다. 각 Column
에 위젯을 추가할 수 있으며 위젯은 지정된 순서대로 표시됩니다. Google Chat 앱의 예는 열을 참고하세요.
각 열의 높이는 더 높은 열에 따라 결정됩니다. 예를 들어 첫 번째 열이 두 번째 열보다 높으면 두 열 모두 첫 번째 열의 높이를 갖습니다. 각 열에 서로 다른 수의 위젯이 포함될 수 있으므로 행을 정의하거나 열 간에 위젯을 정렬할 수 없습니다.
열이 나란히 표시됩니다. HorizontalSizeStyle
필드를 사용하여 각 열의 너비를 맞춤설정할 수 있습니다. 사용자의 화면 너비가 너무 좁으면 두 번째 열이 첫 번째 열 아래로 줄바꿈됩니다.
- 웹에서는 화면 너비가 480픽셀 이하인 경우 두 번째 열이 줄바꿈됩니다.
- iOS 기기에서는 화면 너비가 300pt 이하인 경우 두 번째 열이 줄바꿈됩니다.
- Android 기기에서 화면 너비가 320dp 이하이면 두 번째 열이 줄바꿈됩니다.
Google Chat 앱 및 Google Workspace 부가기능에서 사용할 수 있습니다. 열을 지원하는 부가기능 UI는 다음과 같습니다.
- 사용자가 이메일 초안에서 부가기능을 열 때 표시되는 대화상자입니다.
- 사용자가 Google Calendar 일정의 첨부파일 추가 메뉴에서 부가기능을 열 때 표시되는 대화상자입니다.
// Build a column that is aligned in the center and fills the space:
const column =
CardService.newColumn()
.setHorizontalSizeStyle(
CardService.HorizontalSizeStyle.FILL_AVAILABLE_SPACE)
.setHorizontalAlignment(CardService.HorizontalAlignment.CENTER)
.setVerticalAlignment(CardService.VerticalAlignment.CENTER);
const columns = CardService.newColumns().addColumn(column).setWrapStyle(
CardService.WrapStyle.WRAP);
자세한 문서
addColumn(column)
열 위젯에 Column
를 추가합니다. 열은 추가된 순서대로 표시됩니다. 열은 최대 2개까지 추가할 수 있습니다.
const columns = CardService.newColumns().addColumn(CardService.newColumn());
매개변수
이름 | 유형 | 설명 |
column | Column | Columns 위젯에 추가할 하위 열입니다. |
리턴
Columns
: 연결을 위한 객체입니다.
setWrapStyle(wrapStyle)
열의 줄바꿈 스타일을 설정하고 화면 너비에 따라 열 크기를 조절하는 방식을 제어합니다.
const columns = CardService.newColumns()
.addColumn(CardService.newColumn())
.setWrapStyle(CardService.WrapStyle.WRAP);
매개변수
리턴
Columns
: 연결을 위한 객체입니다.
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-07-26(UTC)
[null,null,["최종 업데이트: 2025-07-26(UTC)"],[[["\u003cp\u003eThe Columns widget allows displaying up to two columns within cards or dialogs, with widgets arranged vertically within each column.\u003c/p\u003e\n"],["\u003cp\u003eColumn height is determined by the taller column, and widgets cannot be aligned across columns or organized into rows.\u003c/p\u003e\n"],["\u003cp\u003eColumns are displayed side-by-side and wrap to a vertical layout on smaller screens based on specified screen width thresholds.\u003c/p\u003e\n"],["\u003cp\u003eCustomization options include adjusting column width and controlling wrapping behavior with \u003ccode\u003eHorizontalSizeStyle\u003c/code\u003e and \u003ccode\u003eWrapStyle\u003c/code\u003e respectively.\u003c/p\u003e\n"],["\u003cp\u003eThis widget is available for Google Chat apps and specific Google Workspace Add-ons, like dialogs in email drafts or Calendar event attachments.\u003c/p\u003e\n"]]],["The Columns widget displays up to two columns in a card or dialog, with widgets added to each column in a specified order. Column height is determined by the taller column, and widths can be customized. If the screen is too narrow, the second column wraps below the first, with specific pixel/point/dp thresholds for web, iOS, and Android devices. Key actions include adding columns using `addColumn()` and controlling resizing with `setWrapStyle()`. These features are available for Google Chat and Workspace add-ons.\n"],null,["# Class Columns\n\nColumns\n\nThe [Columns](#) widget displays up to 2 columns in a card or dialog. You can add widgets to\neach [Column](/apps-script/reference/card-service/column); the widgets appear in the order that they are specified. For an example in\nGoogle Chat apps, see [Columns](https://developers.google.com/workspace/chat/format-structure-card-dialog#display_cards_and_dialogs_in_columns).\n\nThe height of each column is determined by the taller column. For example, if the first column\nis taller than the second column, both columns have the height of the first column. Because each\ncolumn can contain a different number of widgets, you can't define rows or align widgets between\nthe columns.\n\nColumns are displayed side-by-side. You can customize the width of each column using the\n[HorizontalSizeStyle](/apps-script/reference/card-service/horizontal-size-style) field. If the user's screen width is too narrow, the second column\nwraps below the first:\n\n- On web, the second column wraps if the screen width is less than or equal to 480 pixels.\n- On iOS devices, the second column wraps if the screen width is less than or equal to 300 pt.\n- On Android devices, the second column wraps if the screen width is less than or equal to 320 dp.\n\nAvailable for Google Chat apps and Google Workspace add-ons. The add-on UIs that support\ncolumns include:\n\n- The dialog displayed when users open the add-on from an email draft.\n- The dialog displayed when users open the add-on from the **Add attachment** menu in a Google Calendar event. \n\n ```javascript\n // Build a column that is aligned in the center and fills the space:\n const column =\n CardService.newColumn()\n .setHorizontalSizeStyle(\n CardService.HorizontalSizeStyle.FILL_AVAILABLE_SPACE)\n .setHorizontalAlignment(CardService.HorizontalAlignment.CENTER)\n .setVerticalAlignment(CardService.VerticalAlignment.CENTER);\n const columns = CardService.newColumns().addColumn(column).setWrapStyle(\n CardService.WrapStyle.WRAP);\n``` \n\n### Methods\n\n| Method | Return type | Brief description |\n|-----------------------------------------------------|--------------|--------------------------------------------------------------------------------------------|\n| [addColumn(column)](#addColumn(Column)) | [Columns](#) | Adds a [Column](/apps-script/reference/card-service/column) to the Columns widget. |\n| [setWrapStyle(wrapStyle)](#setWrapStyle(WrapStyle)) | [Columns](#) | Sets the wrap style of the columns, controls how the column resizes based on screen width. |\n\nDetailed documentation\n----------------------\n\n### `add``Column(column)`\n\nAdds a [Column](/apps-script/reference/card-service/column) to the Columns widget. Columns are displayed in the order in which\nthey're added. You can add up to two columns.\n\n```javascript\nconst columns = CardService.newColumns().addColumn(CardService.newColumn());\n```\n\n#### Parameters\n\n| Name | Type | Description |\n|----------|------------------------------------------------------|----------------------------------------------|\n| `column` | [Column](/apps-script/reference/card-service/column) | A child column to add to the Columns widget. |\n\n#### Return\n\n\n[Columns](#) --- This object, for chaining.\n\n*** ** * ** ***\n\n### `set``Wrap``Style(wrapStyle)`\n\nSets the wrap style of the columns, controls how the column resizes based on screen width.\n\n```javascript\nconst columns = CardService.newColumns()\n .addColumn(CardService.newColumn())\n .setWrapStyle(CardService.WrapStyle.WRAP);\n```\n\n#### Parameters\n\n| Name | Type | Description |\n|---------------|-------------------------------------------------------------|----------------------------------------|\n| `wrap``Style` | [WrapStyle](/apps-script/reference/card-service/wrap-style) | The wrap style to set for the columns. |\n\n#### Return\n\n\n[Columns](#) --- This object, for chaining."]]