Image
A sized image with required dimensions, lazy loading, and an optional fallback when src is empty.
beta
Examples
Product screenshot
<script lang="ts">
import Image from '@tcpsystems/ui/foundation/Image';
const src = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='320' height='180'%3E%3Crect width='320' height='180' fill='%23334'/%3E%3C/svg%3E";
</script>
<Image {src} alt="Deployments dashboard showing three healthy services" width={320} height={180} />Fallback
No photo uploaded for Maria Chen.
<script lang="ts">
import Image from '@tcpsystems/ui/foundation/Image';
import Text from '@tcpsystems/ui/foundation/Text';
</script>
<Image src="" alt="Maria Chen" width={320} height={180}>
{#snippet fallback()}
<Text tone="muted">No photo uploaded for Maria Chen.</Text>
{/snippet}
</Image>API
import Image from '@tcpsystems/ui/foundation/Image';| Prop | Type | Default |
|---|---|---|
src | string | none |
alt | string | none |
width | number | none |
height | number | none |
loading? | 'lazy' | 'eager' | 'lazy' |
| Snippet |
|---|
fallback |
| Hook | Kind |
|---|---|
.tcp-image | Root class |