{/* Do not edit this file. It is automatically generated by API Documenter. */}


## IconCellRenderer

icon renderer

**Signature:**

```typescript
export interface IconCellRenderer extends CellRenderer
```
**Extends:** [CellRenderer](/refs/Interface/CellRenderer)

## Remarks

Display the image icon and text together.

You can also display by directly specifying the url.

Inherits [CellRenderer](/refs/Interface/CellRenderer).

\[Restrictions\]

1. iconLocation = RIGHT: If the text is long, the icon may not be displayed.

2. `TOP_EDGE`{/* */} and `BOTTOM_EDGE`{/* */} cannot be used in auto height.

\[Superclass\]

[CellRenderer](/refs/Interface/CellRenderer)

## Example


```js
//string type
column.renderer = 'icon';

// object type
column.renderer = {
     "type": "icon",
     "iconMap": {
         "UPQRK": "images/particles/uquark.png",
         "DOWNQRK": "images/particles/dquark.png",
         "ELECTRN": "images/particles/e.png",
         "ELECNEU": "images/particles/eneutrino.png",
     },
     "iconHeight": 11
},
```

## Events

| Property | Type | Description |
| --- | --- | --- |
| [iconCallback](/refs/Interface/IconCellRenderer#iconcallback) | [GetImageCallback](/refs/realgrid#getimagecallback) | Callback for rendering icon image |
| [titleCallback](/refs/Interface/IconCellRenderer#titlecallback) | [GetCellTitleCallback](/refs/realgrid#getcelltitlecallback) | Callback to set alt text of image |

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [enterKey](/refs/Interface/IconCellRenderer#enterkey) | boolean | If true, onCellItemClicked is executed when enterKey is entered. |
| [exportImage](/refs/Interface/IconCellRenderer#exportimage) | boolean | If true, the image is exported to Excel. |
| [iconField](/refs/Interface/IconCellRenderer#iconfield) | string | Field name of the field to be read as a url value for icon image rendering |
| [iconLocation](/refs/Interface/IconCellRenderer#iconlocation) | [IconLocation](/refs/realgrid#iconlocation) | Position of the icon being rendered |
| [iconMap](/refs/Interface/IconCellRenderer#iconmap) | \{ \[value: string\]: string; \} | Key-value pair of cell value and url to correspond to that cell value |
| [iconUrl](/refs/Interface/IconCellRenderer#iconurl) | string | URL of the icon image to show |
| [spaceKey](/refs/Interface/IconCellRenderer#spacekey) | boolean | If true, onCellItemClicked is executed when the space bar is entered. |
| [type](/refs/Interface/IconCellRenderer#type) | "icon" | Type: Icon |

## Events Desc

### iconCallback

Callback for rendering icon images

`Type` - [GetImageCallback](/refs/realgrid#getimagecallback)

**Remarks:**

When `undefined` is returned, rendering by the corresponding callback is canceled.

It follows the format of [GetImageCallback](/refs/realgrid#getimagecallback).

**Example:**


```js
column.renderer = {
 "type": "icon",
 "iconCallback": function (grid, cell) {
 return "images/teraforming/mars.jpg";
 }
}
```

<hr/>

### titleCallback

Callback to set alt text of image

`Type` - [GetCellTitleCallback](/refs/realgrid#getcelltitlecallback)

**Remarks:**

It should return the alt text to be set.

It follows the format of [GetCellTitleCallback](/refs/realgrid#getcelltitlecallback).

**Example:**


```js
const f = function(grid, model) {
 return 'cat image'
}
column.renderer = {
 type: 'icon',
 titleCallback: f
}
```

<hr/>

## Properties Desc

### enterKey

If true, onCellItemClicked is executed when enterKey is entered.

`Type` - boolean

<hr/>

### exportImage

If true, the image is exported to Excel.

`Type` - boolean

**Remarks:**

If [GridExportOptions.exportImage](/refs/Interface/GridExportOptions#exportimage){/* */} is `false`{/* */}, it is not output.

<hr/>

### iconField

Field name of the field to be read as a url value for icon image rendering

`Type` - string

**Remarks:**

Applies when [IconCellRenderer.iconCallback](/refs/Interface/IconCellRenderer#iconcallback) is not assigned or returns `undefined`{/* */}.

**Example:**


```js
column.renderer = {
 "type": "icon",
 "iconField": "Cats"
}
```

<hr/>

### iconLocation

Position of icon rendered

`Type` - [IconLocation](/refs/realgrid#iconlocation)

<hr/>

### iconMap

Key-value pair of cell value and url to correspond to that cell value

`Type` - \{ \[value: string\]: string; \}

**Remarks:**

Applies when [IconCellRenderer.iconCallback](/refs/Interface/IconCellRenderer#iconcallback) is not assigned or returns `undefined`{/* */}.

**Example:**


```js
column.renderer = {
 type: 'icon'
 iconMap: {
 value1: 'images/e_equals_mc_square.jpg'
 }
}
```

<hr/>

### iconUrl

URL of the icon image to show

`Type` - string

**Remarks:**

If [IconCellRenderer.iconMap](/refs/Interface/IconCellRenderer#iconmap) is set, the set value is ignored.

<hr/>

### spaceKey

If true, onCellItemClicked is executed when the space bar is entered.

`Type` - boolean

<hr/>

### type

Category: Icon

`Type` - "icon"

<hr/>