Chip Customization in Chip Control
19 Dec 20225 minutes to read
This section explains the customization of styles, leading icons, avatar, and trailing icons in Chip control.
Styles
The Chip control has the following predefined styles that can be defined using the cssClass
property.
Class | Description |
---|---|
e-primary | Represents a primary chip. |
e-success | Represents a positive chip. |
e-info | Represents an informative chip. |
e-warning | Represents a chip with caution. |
e-danger | Represents a negative chip. |
<ejs-chiplist id="chip-avatar" enableDelete="true">
<e-chips>
<e-chip text="Primary" cssClass="e-primary" enabled="true"></e-chip>
<e-chip text="Success" cssClass="e-success" enabled="true"></e-chip>
<e-chip text="Info" cssClass="e-info" enabled="true"></e-chip>
<e-chip text="Warning" cssClass="e-warning" enabled="true"></e-chip>
<e-chip text="Danger" cssClass="e-danger" enabled="true"></e-chip>
</e-chips>
</ejs-chiplist>
Leading Icon
You can add and customize the leading icon of chip using the leadingIconCss
property.
<ejs-chiplist id="chip-avatar">
<e-chips>
<e-chip text="Andrew" leadingIconCss="andrew" enabled="true"></e-chip>
<e-chip text="Janet" leadingIconCss="janet" enabled="true"></e-chip>
<e-chip text="Laura" leadingIconCss="laura" enabled="true"></e-chip>
<e-chip text="Margaret" leadingIconCss="margaret" enabled="true"></e-chip>
</e-chips>
</ejs-chiplist>
<style>
#chip-avatar .andrew {
background-image: url('./andrew.png')
}
#chip-avatar .margaret {
background-image: url('./margaret.png')
}
#chip-avatar .laura {
background-image: url('./laura.png')
}
#chip-avatar .janet {
background-image: url('./janet.png')
}
</style>
Avatar
You can add and customize the avatar of chip using the avatarIconCss
property.
<ejs-chiplist id="chip-avatar">
<e-chips>
<e-chip text="Andrew" avatarIconCss="andrew" enabled="true"></e-chip>
<e-chip text="Janet" avatarIconCss="janet" enabled="true"></e-chip>
<e-chip text="Laura" avatarIconCss="laura" enabled="true"></e-chip>
<e-chip text="Margaret" avatarIconCss="margaret" enabled="true"></e-chip>
</e-chips>
</ejs-chiplist>
<style>
#chip-avatar .andrew {
background-image: url('./andrew.png')
}
#chip-avatar .margaret {
background-image: url('./margaret.png')
}
#chip-avatar .laura {
background-image: url('./laura.png')
}
#chip-avatar .janet {
background-image: url('./janet.png')
}
</style>
Avatar Content
You can add and customize the avatar content of chip using the avatarText
property.
<ejs-chiplist id="chip-avatar">
<e-chips>
<e-chip text="Andrew" AvatarText="A" enabled="true"></e-chip>
<e-chip text="Janet" AvatarText="J" enabled="true"></e-chip>
<e-chip text="Laura" AvatarText="L" enabled="true"></e-chip>
<e-chip text="Margaret" AvatarText="M" enabled="true"></e-chip>
</e-chips>
</ejs-chiplist>
Trailing Icon
You can add and customize the trailing icon of chip using the trailingIconCss
property.
<ejs-chiplist id="chip-avatar">
<e-chips>
<e-chip text="Andrew" trailingIconCss="e-dlt-btn" enabled="true"></e-chip>
<e-chip text="Janet" trailingIconCss="e-dlt-btn" enabled="true"></e-chip>
<e-chip text="Laura" trailingIconCss="e-dlt-btn" enabled="true"></e-chip>
<e-chip text="Margaret" trailingIconCss="e-dlt-btn" enabled="true"></e-chip>
</e-chips>
</ejs-chiplist>
Outline Chip
Outline chip has the border with the background transparent. It can be set using the cssClass
property.
<div>
<ejs-chiplist id="chip" cssClass="e-outline">
<e-chips>
<e-chip text="Chai"></e-chip>
<e-chip text="Chang"></e-chip>
<e-chip text="Aniseed Syrup"></e-chip>
<e-chip text="Ikura"></e-chip>
</e-chips>
</ejs-chiplist>
<ejs-chiplist id="chip" cssClass="e-outline" enableDelete="true">
<e-chips>
<e-chip text="Andrew"></e-chip>
<e-chip text="Janet"></e-chip>
<e-chip text="Laura"></e-chip>
<e-chip text="Margaret"></e-chip>
</e-chips>
</ejs-chiplist>
</div>
NOTE