ImageGallery
A grid of images.
On this page
Examples
Gallery
Trip to the coast
Razor
<div class="w-full max-w-xl">
<KlyImageGallery Caption="Trip to the coast" Max="3" Columns="3" Images="@_photos" />
</div>
@code {
private readonly KlyGalleryImage[] _photos =
[
new("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 3'%3E%3Crect width='4' height='3' fill='%2310b981'/%3E%3C/svg%3E") { Alt = "Green", Width = 4, Height = 3 },
new("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 3'%3E%3Crect width='4' height='3' fill='%23ec4899'/%3E%3C/svg%3E") { Alt = "Pink", Width = 4, Height = 3 },
new("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 3'%3E%3Crect width='4' height='3' fill='%236366f1'/%3E%3C/svg%3E") { Alt = "Indigo", Width = 4, Height = 3 },
new("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 3'%3E%3Crect width='4' height='3' fill='%23f59e0b'/%3E%3C/svg%3E") { Alt = "Amber", Width = 4, Height = 3 },
new("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 3'%3E%3Crect width='4' height='3' fill='%2314b8a6'/%3E%3C/svg%3E") { Alt = "Teal", Width = 4, Height = 3 },
];
}API
KlyImageGallery
A grid of images with a +N overflow tile.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
Caption |
string |
A line of smaller text under the gallery. | |
Class |
string |
Classes added to the root element, merged last so they win over the theme. | |
Columns |
int |
3 |
The number of columns of the grid, from 1 to 6 ( 3 by default; other values are clamped). |
ImageOptions |
KlyImageOptions |
Image settings forwarded to every KlyImage of the gallery. | |
Images |
IReadOnlyList |
The images, as KlyGalleryImage . | |
Loading |
bool |
false |
Shows a skeleton placeholder instead of the content. |
Max |
int |
3 |
The number of tiles shown. The last one carries a +N overflow when more images exist ( 3 by default, at least 1 ). |
Surface |
KlySurface? |
The surface treatment. Plain when not set. Values: Plain, Muted, Bordered, Elevated. |
|
Ui |
ImageGalleryUi |
Per-instance class overrides of the slots of the gallery, see ImageGalleryUi . They are merged after the theme and the Class parameter wins on the root slot. |
Ui slots
Ui takes a ImageGalleryUi with one class string per slot, merged after the theme.
| Slot | Styles |
|---|---|
Root |
Classes merged into the root slot of KlyImageGallery , after the theme and the app configuration. |
Grid |
Classes merged into the grid slot of KlyImageGallery , after the theme and the app configuration. |
Tile |
Classes merged into the tile slot of KlyImageGallery , after the theme and the app configuration. |
Image |
Classes merged into the image slot of KlyImageGallery , after the theme and the app configuration. |
Overflow |
Classes merged into the overflow slot of KlyImageGallery , after the theme and the app configuration. |
Caption |
Classes merged into the caption slot of KlyImageGallery , after the theme and the app configuration. |
Skeleton |
Classes merged into the skeleton slot of KlyImageGallery , after the theme and the app configuration. |