• Start
  • Blogg
  • Kom igång
  • Riktlinjer
  • Komponenter
  • Changelog
  • Tillgänglighet
  • Inställningar

Komponenter

Komponenter

​
​

Inga resultat hittade, prova med andra sökvillkor.

Image

Image

3.0.11

A description of this component is work in progress.

Demo
Props
Installation
Länkar
Tillgänglighet
Change log
Statistik

Demo

Props

Se fullständing dokumentation(öppnas i ny flik)
NamnTypBeskrivning

alt *

stringSpecifies an alternate text for an image. Use "" if image is decorative.

aspectRatio

"undefined" | numberOverride aspect ratio. Should be a ratio expressed as width divided by height, e.g. 3/2 or 1/1.

className

stringSpecifies additional CSS classes to be applied to the root element.

customAttribute

{ attribute: string; value: string | number }Used for tests. Clickable and requested subcomponents will be suffixed with "-[ComponentName]".

errorFallback

ElementSpecify a fallback to display if the image fails to load.

imageSx

SxPropsCustom styles to be applied to the image element.

isLoading

booleanIf true, a loading skeleton will be rendered instead of the component.

loadingFallback

ElementSpecify a fallback to display while the image is loading.

onError

(event: SyntheticEvent) => voidCallback function triggered when the image fails to load.

onLoad

(event: SyntheticEvent) => voidCallback function triggered when the image is successfully loaded.

rootSx

SxPropsCustom styles to be applied to the root container of the image.

sizes

stringSpecifies an optional 'sizes' attribute for the image element. Should be used in conjunction with 'srcSet' to define image sizes for different viewport conditions.

src *

stringThe URL of the image to be displayed.

srcSet

stringSpecifies an optional 'srcset' attribute for the image element.

Installation

Kodexempel
npm install @sj-ab/component-library.ui.image

Länkar

  • Storybook

  • Figma

  • Bit.cloud

Tillgänglighet

Meningsbärande bilder måste alltid ha en alt-text som beskriver bildens innehåll för användare som inte ser den.

Change log

  • Add .js extensions to internal imports

    3.0.7
  • EditorialCard

    3.0.6
  • Migrate to ESLint 9

    3.0.4
  • Add .vscode/tasks.json for task automation

    3.0.3

Statistik