Asset

Represent an asset visually without showing the actual asset.

Useful in a file selector, a drag-n-drop component or in lists.

Import

import { Asset } from '@contentful/f36-components';
// or
import { Asset } from '@contentful/f36-asset';

Examples

Basic usage

An image asset

By default an asset with the type image will render the src attribute directly, like a HTML <img /> element.

An archived image asset

If asset status is set to archived, an image icon is displayed instead of the actual image.

Props (API reference)

Open in Storybook

Name

Type

Default

className
string

CSS class to be appended to the root element

src
string

A `src` attribute to use for image assets

status
"archived"
"changed"
"deleted"
"draft"
"published"

The publish status of the asset

testId
string

A [data-test-id] attribute used for testing purposes

title
string

The title of the asset

type
"archive"
"audio"
"code"
"image"
"markup"
"pdf"
"plaintext"
"presentation"
"richtext"
"spreadsheet"
"video"

The type of asset being represented