Skip to content

Commit ecb87cc

Browse files
committed
Add docs
1 parent 0671685 commit ecb87cc

File tree

2 files changed

+79
-6
lines changed

2 files changed

+79
-6
lines changed

docs/package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/src/pages/docs/en/components/media-preview-thumbnail.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,76 @@ For more details on how thumbnails are integrated and controlled, see [`<media-t
4747
mediapreviewcoords="284 640 284 160"
4848
></media-preview-thumbnail>
4949
```
50+
51+
## Sizing and Customization
52+
53+
The preview thumbnail size is controlled via CSS custom properties on the [`<media-time-range>`](media-time-range) component:
54+
55+
```css
56+
media-time-range {
57+
--media-preview-thumbnail-max-width: 200px;
58+
--media-preview-thumbnail-max-height: 200px;
59+
}
60+
```
61+
62+
### Aspect Ratio Behavior
63+
64+
By default, thumbnails maintain their original aspect ratio using `--media-preview-thumbnail-object-fit: contain` (the default). This means:
65+
66+
- The thumbnail scales to fit within the max/min dimensions
67+
- The original aspect ratio is preserved
68+
- Setting equal width and height won't create a square if the source isn't square
69+
70+
**Example with default behavior:**
71+
72+
```css
73+
media-time-range {
74+
--media-preview-thumbnail-max-width: 200px;
75+
--media-preview-thumbnail-max-height: 200px;
76+
/* Maintains aspect ratio - won't be square unless source is square */
77+
}
78+
```
79+
80+
### Independent Width/Height Scaling
81+
82+
To allow independent width and height scaling (useful for square thumbnails or vertical videos), use `object-fit: fill`:
83+
84+
```css
85+
media-time-range {
86+
--media-preview-thumbnail-max-width: 200px;
87+
--media-preview-thumbnail-max-height: 200px;
88+
--media-preview-thumbnail-object-fit: fill;
89+
/* Creates square thumbnails by stretching to fill */
90+
}
91+
```
92+
93+
### Vertical Video Thumbnails
94+
95+
For vertical/portrait videos (like TikTok or Instagram Stories), use taller dimensions with `object-fit: fill`:
96+
97+
```css
98+
media-time-range {
99+
--media-preview-thumbnail-max-width: 160px;
100+
--media-preview-thumbnail-max-height: 384px;
101+
--media-preview-thumbnail-object-fit: fill;
102+
}
103+
```
104+
105+
## CSS Custom Properties
106+
107+
### Available Properties
108+
109+
| Property | Default | Description |
110+
|----------|---------|-------------|
111+
| `--media-preview-thumbnail-max-width` | `180px` | Maximum thumbnail width |
112+
| `--media-preview-thumbnail-max-height` | `160px` | Maximum thumbnail height |
113+
| `--media-preview-thumbnail-min-width` | `120px` | Minimum thumbnail width |
114+
| `--media-preview-thumbnail-min-height` | `80px` | Minimum thumbnail height |
115+
| `--media-preview-thumbnail-object-fit` | `contain` | Scaling behavior: `contain` (maintains aspect ratio) or `fill` (independent width/height) |
116+
| `--media-preview-thumbnail-background` | - | Background color |
117+
| `--media-preview-thumbnail-box-shadow` | `0 0 4px rgba(0,0,0,0.2)` | Box shadow |
118+
| `--media-preview-thumbnail-border` | - | Border style |
119+
| `--media-preview-thumbnail-border-radius` | - | Border radius |
120+
121+
**Note:** Using `fill` may cause image stretching if the aspect ratio doesn't match the source thumbnails.
122+
```

0 commit comments

Comments
 (0)