Next to a visible name, make it decorative
By default the tile is announced as an image named after the app. When the name is already written beside it, as in a table's name column, set decorative so it is not read twice.
vue
<template>
<span class="app-name">
<NbAppIcon :name="app.name" :src="app.logoUrl" size="sm" decorative />
{{ app.name }}
</span>
</template>Only pass addresses you trust
src goes straight into an <img>. When the address comes from people (an app registry where admins type a logo URL), check it is http: or https: before passing it, and pass null otherwise. The tile then shows initials.
Sizes
size takes a step of the scale, xs (20), sm (24), md (28) or lg (40), the same steps as NbAvatar, or a number of pixels for a size the scale does not carry. The initials scale with the tile.
vue
<template>
<NbAppIcon :name="app.name" :size="18" />
<NbAppIcon :name="app.name" :size="56" />
</template>Props
| Prop | Type | Default | Description |
|---|---|---|---|
name | string | null | The app's name. Gives the initials and the accessible name. | |
src | string | null | Icon URL. Absent, empty or failing to load shows initials. | |
size | 'xs' | 'sm' | 'md' | 'lg' | number | 'md' | 20, 24, 28 or 40 pixels, or any number of pixels. |
background | string | unset | Background behind the initials. Any CSS colour, including a token. |
color | string | unset | Colour of the initials, for a background the default will not read on. |
decorative | boolean | false | Hide from assistive technology, for when the name is already visible. |