Async Emblem

A composable component for asynchronously loading and displaying images with automatic loading and error state handling

Import

Jetpack Compose framework

Before you can use components from the Backbase Design System SDK, make sure you've installed the package and import it at the top of your file.


                                                        
                                                        
                                                            import com.backbase.android.design.component.AsyncEmblem
                                                        import com.backbase.android.design.component.EmblemLayout
                                                        import com.backbase.android.design.component.EmblemLayouts
                                                        import com.backbase.android.design.component.EmblemColorScheme
                                                        import com.backbase.android.design.component.EmblemColorSchemes
                                                        import androidx.compose.ui.Modifier
                                                        import androidx.compose.ui.graphics.painter.Painter
                                                        import androidx.compose.ui.layout.ContentScale
                                                        import androidx.compose.ui.unit.dp
                                                        
                                                            

 

Usage

Basic usage

Create an AsyncEmblem to load and display images from URLs with automatic state management.

Async Emblem / Emblem | Basic usage

                                                        
                                                        
                                                            AsyncEmblem(
                                                            url = "https://example.com/image.png",
                                                            contentDescription = "Company logo"
                                                        )
                                                        
                                                            

 

Custom layout and styling

Use AsyncEmblem with custom layout sizes and color schemes for different visual contexts.


                                                        
                                                        
                                                            AsyncEmblem(
                                                            url = "https://example.com/profile.jpg",
                                                            contentDescription = "User profile",
                                                            layout = EmblemLayouts.lg,
                                                            placeholderColorScheme = EmblemColorSchemes.brand
                                                        )
                                                        
                                                            

 

Configuration

Parameter

Type

Default

contentDescription

String?

Required

contentScale

ContentScale

ContentScale.Fit

layout

EmblemLayout

EmblemLayouts.md

modifier

Modifier

Modifier

placeholderColorScheme

EmblemColorScheme

EmblemColorSchemes.neutral

placeholderPainter

Painter

Icons.Painter.iconShoppingBag

url

String

Required

 

contentDescription

The contentDescription parameter provides accessibility information for screen readers when describing the image content.


                                                        
                                                        
                                                            AsyncEmblem(
                                                            url = "https://example.com/badge.png",
                                                            contentDescription = "Verified account badge"
                                                        )
                                                        
                                                            

 

contentScale

The contentScale parameter defines how the loaded image scales within the emblem bounds.


                                                        
                                                        
                                                            AsyncEmblem(
                                                            url = "https://example.com/image.png",
                                                            contentDescription = "Scaled image",
                                                            contentScale = ContentScale.Crop
                                                        )
                                                        
                                                            

 

layout

The layout parameter determines the size and shape of the emblem container.

Async Emblem / Emblem | Layout

                                                        
                                                        
                                                            AsyncEmblem(
                                                            url = "https://example.com/icon.png",
                                                            contentDescription = "Large icon",
                                                            layout = EmblemLayouts.xl
                                                        )
                                                        
                                                            

 

modifier

The modifier parameter allows custom layout and styling modifications to the emblem.


                                                        
                                                        
                                                            AsyncEmblem(
                                                            url = "https://example.com/image.png",
                                                            contentDescription = "Custom styled emblem",
                                                            modifier = Modifier.padding(16.dp)
                                                        )
                                                        
                                                            

 

placeholderColorScheme

The placeholderColorScheme parameter sets the color scheme used when displaying the placeholder in error states.


                                                        
                                                        
                                                            AsyncEmblem(
                                                            url = "https://example.com/image.png",
                                                            contentDescription = "Error state emblem",
                                                            placeholderColorScheme = EmblemColorSchemes.danger
                                                        )
                                                        
                                                            

 

placeholderPainter

The placeholderPainter parameter defines the fallback image displayed when the URL fails to load.


                                                        
                                                        
                                                            AsyncEmblem(
                                                            url = "https://example.com/image.png",
                                                            contentDescription = "Custom placeholder",
                                                            placeholderPainter = Icons.Painter.iconPerson
                                                        )
                                                        
                                                            

 

url

The url parameter specifies the image URL to load asynchronously.


                                                        
                                                        
                                                            AsyncEmblem(
                                                            url = "https://cdn.example.com/user-avatar.jpg",
                                                            contentDescription = "User avatar"
                                                        )
                                                        
                                                            

 

Loading states

Automatic state management

The AsyncEmblem automatically manages loading and error states based on the image loading progress.


                                                        
                                                        
                                                            // Component automatically shows:
                                                        // - Shimmer animation during loading
                                                        // - Placeholder with error styling on failure
                                                        // - Actual image when successfully loaded
                                                        AsyncEmblem(
                                                            url = "https://example.com/dynamic-image.png",
                                                            contentDescription = "Dynamic content"
                                                        )
                                                        
                                                            

 

Loading state behavior

During loading, the component displays a shimmer animation with the emblem's shape and size.

Async Emblem | Loading

                                                        
                                                        
                                                            // Loading state shows shimmer background
                                                        AsyncEmblem(
                                                            url = "https://slow-loading-image.com/image.png",
                                                            contentDescription = "Loading image",
                                                            layout = EmblemLayouts.lg
                                                        )
                                                        
                                                            

 

Error state behavior

When image loading fails, the component displays the placeholder painter with the specified color scheme.


                                                        
                                                        
                                                            // Error state shows placeholder with color scheme styling
                                                        AsyncEmblem(
                                                            url = "https://invalid-url.com/missing.png",
                                                            contentDescription = "Failed to load",
                                                            placeholderPainter = Icons.Painter.iconError,
                                                            placeholderColorScheme = EmblemColorSchemes.danger
                                                        )
                                                        
                                                            

 

Layout options

EmblemLayouts

The EmblemLayouts object provides predefined size configurations:

  • sm: Small emblem size
  • md: Medium emblem size (default)
  • lg: Large emblem size
  • xl: Extra large emblem size
Async Emblem / Emblem | Layout

                                                        
                                                        
                                                            // Different layout sizes
                                                        AsyncEmblem(url = "https://example.com/small.png", contentDescription = "Small", layout = EmblemLayouts.sm)
                                                        AsyncEmblem(url = "https://example.com/medium.png", contentDescription = "Medium", layout = EmblemLayouts.md)
                                                        AsyncEmblem(url = "https://example.com/large.png", contentDescription = "Large", layout = EmblemLayouts.lg)
                                                        AsyncEmblem(url = "https://example.com/xlarge.png", contentDescription = "Extra Large", layout = EmblemLayouts.xl)
                                                        
                                                            

 

Color schemes

EmblemColorSchemes

The EmblemColorSchemes object provides predefined color configurations:

  • brand: Brand colors for primary branding
  • neutral: Neutral colors for general use
  • info: Information state colors
  • success: Success state colors
  • warning: Warning state colors
  • danger: Error/danger state colors
  • category1 through category10: Category-specific colors
Async Emblem | Color schemes

                                                        
                                                        
                                                            // Different color schemes
                                                        AsyncEmblem(url = "https://example.com/brand.png", contentDescription = "Brand", placeholderColorScheme = EmblemColorSchemes.brand)
                                                        AsyncEmblem(url = "https://example.com/success.png", contentDescription = "Success", placeholderColorScheme = EmblemColorSchemes.success)
                                                        AsyncEmblem(url = "https://example.com/category.png", contentDescription = "Category", placeholderColorScheme = EmblemColorSchemes.category1)
                                                        
                                                            

 

Design tokens

The AsyncEmblem component uses design tokens for consistent styling:

  • Colors: Color schemes use semantic design tokens for consistent theming
  • Layout: Size and shape configurations follow design system spacing
  • Animation: Shimmer loading animation uses design system patterns
  • Typography: Inherits text styling for accessibility descriptions

                                                        
                                                        
                                                            // Component automatically applies design system styling through EmblemLayouts and EmblemColorSchemes
                                                        AsyncEmblem(
                                                            url = "https://example.com/themed-image.png",
                                                            contentDescription = "Themed emblem",
                                                            layout = EmblemLayouts.md,
                                                            placeholderColorScheme = EmblemColorSchemes.neutral
                                                        )
                                                        
                                                            

 

color / emblem / category-3
#fce7f2
background
{ "include_for": ["ios", "android"], }
#82345b
foreground
{ "include_for": ["ios", "android"], }
#fce7f2
border
{ "include_for": ["ios", "android"], }
color / emblem / brand
#dee2ff
background
{ "include_for": ["ios", "android"], }
#152f80
foreground
{ "include_for": ["ios", "android"], }
#dee2ff
border
{ "include_for": ["ios", "android"], }
color / emblem / warning
#fef6df
background
{ "include_for": ["ios", "android"], }
#8a6a19
foreground
{ "include_for": ["ios", "android"], }
#fef6df
border
{ "include_for": ["ios", "android"], }
color / emblem / danger
#f5dedb
background
{ "include_for": ["ios", "android"], }
#691309
foreground
{ "include_for": ["ios", "android"], }
#f5dedb
border
{ "include_for": ["ios", "android"], }
color / emblem / category-1
#fadcd9
background
{ "include_for": ["ios", "android"], }
#7b0d00
foreground
{ "include_for": ["ios", "android"], }
#fadcd9
border
{ "include_for": ["ios", "android"], }
color / emblem / category-2
#ffecd9
background
{ "include_for": ["ios", "android"], }
#8c4600
foreground
{ "include_for": ["ios", "android"], }
#ffecd9
border
{ "include_for": ["ios", "android"], }
color / emblem / category-5
#e8dcf8
background
{ "include_for": ["ios", "android"], }
#390d72
foreground
{ "include_for": ["ios", "android"], }
#e8dcf8
border
{ "include_for": ["ios", "android"], }
color / emblem / category-6
#ddf8f8
background
{ "include_for": ["ios", "android"], }
#117474
foreground
{ "include_for": ["ios", "android"], }
#ddf8f8
border
{ "include_for": ["ios", "android"], }
color / emblem / category-7
#e2f5ec
background
{ "include_for": ["ios", "android"], }
#236949
foreground
{ "include_for": ["ios", "android"], }
#e2f5ec
border
{ "include_for": ["ios", "android"], }
color / emblem / category-8
#ebf7dc
background
{ "include_for": ["ios", "android"], }
#436d0c
foreground
{ "include_for": ["ios", "android"], }
#ebf7dc
border
{ "include_for": ["ios", "android"], }
color / emblem / category-9
#fdf5db
background
{ "include_for": ["ios", "android"], }
#856707
foreground
{ "include_for": ["ios", "android"], }
#fdf5db
border
{ "include_for": ["ios", "android"], }
color / emblem / category-10
#e1e4e7
background
{ "include_for": ["ios", "android"], }
#202833
foreground
{ "include_for": ["ios", "android"], }
#e1e4e7
border
{ "include_for": ["ios", "android"], }
color / emblem / category-4
#dfe7ff
background
{ "include_for": ["ios", "android"], }
#17348c
foreground
{ "include_for": ["ios", "android"], }
#dfe7ff
border
{ "include_for": ["ios", "android"], }
color / emblem / neutral
#ccd5df
background
{ "include_for": ["ios", "android"], }
#091c35
foreground
{ "include_for": ["ios", "android"], }
#ccd5df
border
{ "include_for": ["ios", "android"], }
color / emblem / info
#dfe7ff
background
{ "include_for": ["ios", "android"], }
#17348c
foreground
{ "include_for": ["ios", "android"], }
#dfe7ff
border
{ "include_for": ["ios", "android"], }
color / emblem / success
#dbece2
background
{ "include_for": ["ios", "android"], }
#084722
foreground
{ "include_for": ["ios", "android"], }
#dbece2
border
{ "include_for": ["ios", "android"], }
radius / emblem
8px
8px
sm
{ "units_for": { "web": "rem" }, "include_for": ["ios", "android"], }
12px
12px
md
{ "units_for": { "web": "rem" }, "include_for": ["ios", "android"], }
16px
16px
lg
{ "units_for": { "web": "rem" }, "include_for": ["ios", "android"], }
20px
20px
xl
{ "units_for": { "web": "rem" }, "include_for": ["ios", "android"], }
height / emblem
40px
40px
sm
{ "units_for": { "web": "rem" }, "include_for": ["ios", "android"], }
48px
48px
md
{ "units_for": { "web": "rem" }, "include_for": ["ios", "android"], }
64px
64px
lg
{ "units_for": { "web": "rem" }, "include_for": ["ios", "android"], }
80px
80px
xl
{ "units_for": { "web": "rem" }, "include_for": ["ios", "android"], }
height / emblem / icon
24px
24px
sm
{ "units_for": { "web": "rem" }, "include_for": ["ios", "android"], }
28px
28px
md
{ "units_for": { "web": "rem" }, "include_for": ["ios", "android"], }
40px
40px
lg
{ "units_for": { "web": "rem" }, "include_for": ["ios", "android"], }
48px
48px
xl
{ "units_for": { "web": "rem" }, "include_for": ["ios", "android"], }