mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-20 20:33:02 +00:00
* chore(deps-dev): remove @carbon/themes * chore(deps-dev): bump devDependencies * fix(tabs): forward click event to Tab * feat(toggle): dispatch toggle event * feat(tag): dispatch close event * feat(tooltip-icon): make tooltipText slottable * feat(dropdown): add hideLabel prop * docs(select): add "Hidden label" example * refactor(modal): use class directive * feat(modal): dispatch transitionend event * chore(deps-dev): upgrade carbon-components to 10.28.0-rc.0 * feat(date-picker): add warn state * feat(tag): support small size variant * fix(search): add semantic role * feat(toolbar-search): add disabled state * fix(composed-modal): add aria-label prop, update header semantic tags * chore(deps-dev): upgrade carbon-components to v10.28 * docs(overflow-menu): add light variant example * docs(link): document OutboundLink in Component API * chore(tooltip-icon): rename slot to "tooltipText" * docs(component-api): wrap code blocks to minimize width * docs(aspect-ratio): remove inline outline style * fix(tab): do not trigger focus when mounting * docs(tabs): add reactive example Closes #438
56 lines
No EOL
924 B
Text
56 lines
No EOL
924 B
Text
<script>
|
|
import { AspectRatio, Tile } from "carbon-components-svelte";
|
|
import Preview from "../../components/Preview.svelte";
|
|
</script>
|
|
|
|
The `AspectRatio` component is useful for constraining fluid content within an aspect ratio. To demo this, resize your browser for the examples below.
|
|
|
|
Supported aspect ratios: `"2x1"`, `"16x9"`, `"4x3"`, `"1x1"`, `"3x4"`, `"9x16"`, `"1x2"`
|
|
|
|
### Default (2x1)
|
|
|
|
<AspectRatio>
|
|
2x1
|
|
</AspectRatio>
|
|
|
|
### Ratio 16x9
|
|
|
|
<AspectRatio ratio="16x9">
|
|
16x9
|
|
</AspectRatio>
|
|
|
|
### Ratio 4x3
|
|
|
|
<AspectRatio ratio="4x3">
|
|
4x3
|
|
</AspectRatio>
|
|
|
|
### Ratio 1x1
|
|
|
|
<AspectRatio ratio="1x1">
|
|
1x1
|
|
</AspectRatio>
|
|
|
|
### Ratio 3x4
|
|
|
|
<AspectRatio ratio="3x4">
|
|
3x4
|
|
</AspectRatio>
|
|
|
|
### Ratio 9x16
|
|
|
|
<AspectRatio ratio="9x16">
|
|
9x16
|
|
</AspectRatio>
|
|
|
|
### Ratio 1x2
|
|
|
|
<AspectRatio ratio="1x2">
|
|
1x2
|
|
</AspectRatio>
|
|
|
|
### Tile (16x9)
|
|
|
|
<AspectRatio ratio="16x9">
|
|
<Tile style="height: 100%">Content</Tile>
|
|
</AspectRatio> |