|
| 1 | +--- |
| 2 | +icon: credit-card |
| 3 | +category: display-data |
| 4 | +summary: Arrange records in cards with images, links, or embedded content. |
| 5 | +top: |
| 6 | + - class |
| 7 | + - name: columns |
| 8 | + type: INTEGER |
| 9 | + description: The number of columns in the grid of cards. This is just a hint, the grid will adjust dynamically |
| 10 | + to the user's screen size, rendering fewer columns if needed to fit the contents. To control the size |
| 11 | + of cards individually, use the `width` row-level property instead. |
| 12 | + - name: description |
| 13 | + type: TEXT |
| 14 | + description: A short paragraph displayed below the title. |
| 15 | + - name: description_md |
| 16 | + type: TEXT |
| 17 | + description: A short paragraph displayed below the title - formatted using markdown. |
| 18 | + - name: title |
| 19 | + type: TEXT |
| 20 | + description: Text header at the top of the list of cards. |
| 21 | +row: |
| 22 | + - name: active |
| 23 | + type: BOOLEAN |
| 24 | + description: Whether this item in the grid is considered "active". Active items are displayed more prominently. |
| 25 | + - name: allow |
| 26 | + type: TEXT |
| 27 | + description: The permissions policy of the iframe embed code, for instance "fullscreen; clipboard-write". |
| 28 | + Used only when embed_mode is 'iframe'. |
| 29 | + - name: background_color |
| 30 | + type: COLOR |
| 31 | + description: The background color of the card. |
| 32 | + - class |
| 33 | + - name: color |
| 34 | + type: COLOR |
| 35 | + description: The name of a color, to be displayed on the left of the card to highlight it. If the embed |
| 36 | + parameter is enabled and you don't have a title or description, this parameter won't apply. |
| 37 | + - name: description |
| 38 | + type: TEXT |
| 39 | + description: |- |
| 40 | + The body of the card, where you put the main text contents of the card. |
| 41 | + This does not support rich text formatting, only plain text. |
| 42 | + If you want to use rich text formatting, use the `description_md` property instead. |
| 43 | + - name: description_md |
| 44 | + type: TEXT |
| 45 | + description: |2- |
| 46 | +
|
| 47 | + The body of the card, in Markdown format. |
| 48 | + This is useful if you want to display a lot of text in the card, with many options for formatting, such as |
| 49 | + line breaks, **bold**, *italics*, lists, #titles, [links](target.sql), , etc. |
| 50 | + - name: embed |
| 51 | + type: TEXT |
| 52 | + description: |- |
| 53 | + A url whose contents will be fetched and injected into the body of this card. |
| 54 | + This can be used to inject arbitrary html content, but is especially useful for injecting |
| 55 | + the output of other sql files rendered by SQLPage. For the latter case you can pass the |
| 56 | + `?_sqlpage_embed` query parameter, which will skip the shell layout. |
| 57 | + Components inside the fetched content initialize automatically. Custom scripts that insert |
| 58 | + SQLPage fragments should dispatch a bubbling `fragment-loaded` event on the element containing |
| 59 | + the new content. Initialization includes that element and its descendants; dispatching the |
| 60 | + event on `document` initializes pending components throughout the page. Repeated events |
| 61 | + preserve existing form and widget handlers |
| 62 | + - name: embed_mode |
| 63 | + type: TEXT |
| 64 | + description: |- |
| 65 | + Set to 'iframe' to embed the target (specified through embed property) in an iframe. |
| 66 | + Unless this is explicitly set, the embed target is fetched and injected within the parent page. If embed_mode is set to iframe, |
| 67 | + You can also set height and width parameters to configure the appearance and the sandbox and allow parameters to configure |
| 68 | + security aspects of the iframe. Refer to the [MDN page](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe) |
| 69 | + for an explanation of these parameters. |
| 70 | + - name: footer |
| 71 | + type: TEXT |
| 72 | + description: Muted text to display at the bottom of the card. |
| 73 | + - name: footer_link |
| 74 | + type: URL |
| 75 | + description: An URL to which the user should be taken when they click on the footer. |
| 76 | + - name: footer_md |
| 77 | + type: TEXT |
| 78 | + description: Muted text to display at the bottom of the card, with rich text formatting in Markdown format. |
| 79 | + - name: height |
| 80 | + type: INTEGER |
| 81 | + description: Height of the iframe embed code, in pixels. Used only when embed_mode is 'iframe'. |
| 82 | + - name: icon |
| 83 | + type: ICON |
| 84 | + description: Name of an icon to display on the right side of the card. |
| 85 | + - id |
| 86 | + - name: link |
| 87 | + type: URL |
| 88 | + description: An URL to which the user should be taken when they click on the card. |
| 89 | + - name: sandbox |
| 90 | + type: TEXT |
| 91 | + description: The restrictions to apply to the iframe embed code, for instance "allow-scripts allow-same-origin". |
| 92 | + Used only when embed_mode is 'iframe'. |
| 93 | + - name: style |
| 94 | + type: TEXT |
| 95 | + description: 'Inline style property to your iframe embed code. For example "background-color: #FFFFFF"' |
| 96 | + - name: target |
| 97 | + type: TEXT |
| 98 | + description: 'Where the card''s link opens: "_blank" for a new tab, "_self" for the same tab, "_parent" |
| 99 | + for the parent frame, or "_top" for the full body of the window.' |
| 100 | + - name: title |
| 101 | + type: TEXT |
| 102 | + required: true |
| 103 | + description: Name of the card, displayed at the top. |
| 104 | + - name: top_image |
| 105 | + type: URL |
| 106 | + description: The URL (absolute or relative) of an image to display at the top of the card. |
| 107 | + - name: top_image_height |
| 108 | + type: INTEGER |
| 109 | + description: Specify the top image height, in pixels. Helps prevent layout shifts. |
| 110 | + - name: top_image_lazy |
| 111 | + type: BOOLEAN |
| 112 | + description: Whether the top image must be lazily loaded. Defaults to false, meaning eagerly loaded. |
| 113 | + - name: top_image_width |
| 114 | + type: INTEGER |
| 115 | + description: Specify the top image width, in pixels. Helps prevent layout shifts. |
| 116 | + - name: width |
| 117 | + type: INTEGER |
| 118 | + description: The width of the card, between 1 (smallest) and 12 (full-width). The default width is 3, resulting |
| 119 | + in 4 cards per line. When embed_mode is 'iframe', this is used as the width of the iframe instead, and |
| 120 | + defaults to 100%. |
| 121 | +--- |
| 122 | + |
| 123 | +A grid where each element is a small card that displays a piece of data. |
0 commit comments