This section explains the customization of styles, leading icons, avatar, and trailing icons in Chip control.
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. |
import { ChipList } from '@syncfusion/ej2-buttons';
new ChipList({chips: [{
"text": "Apple",
"cssClass": "e-primary"
},
{
"text": "Microsoft",
"cssClass": "e-info"
},
{
"text": "Google",
"cssClass": "e-success"
},
{
"text": "Tesla",
"cssClass": "e-warning"
},
{
"text": "Intel",
"cssClass": "e-danger"
}
] }, '#chip');
<!DOCTYPE html>
<html lang="en">
<head>
<title>EJ2 Chip</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Typescript UI Controls" />
<meta name="author" content="Syncfusion" />
<link href="//cdn.syncfusion.com/ej2/20.4.48/ej2-buttons/styles/material.css" rel="stylesheet" />
<link href="//cdn.syncfusion.com/ej2/20.4.48/ej2-base/styles/material.css" rel="stylesheet" />
<link href="styles.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
</head>
<body>
<div id='loader'>LOADING....</div>
<div id='container'>
<div id="chip"></div>
</div>
</body>
</html>
#loader {
color: #008cff;
height: 40px;
width: 30%;
position: absolute;
font-family: 'Helvetica Neue','calibiri';
font-size:16px;
top: 45%;
left: 45%;
}
#chip .andrew {
background-image: url('https://ej2.syncfusion.com/demos/src/chips/images/andrew.png')
}
#chip .margaret {
background-image: url('https://ej2.syncfusion.com/demos/src/chips/images/margaret.png')
}
#chip .laura {
background-image: url('https://ej2.syncfusion.com/demos/src/chips/images/laura.png')
}
#chip .janet {
background-image: url('https://ej2.syncfusion.com/demos/src/chips/images/janet.png')
}
You can add and customize the leading icon of chip using the leadingIconCss
property.
import { ChipList } from '@syncfusion/ej2-buttons';
new ChipList({chips: [{
"text": "Anne",
"leadingIconCss": "andrew"
},
{
"text": "Janet",
"leadingIconCss": "janet"
},
{
"text": "Laura",
"leadingIconCss": "laura"
},
{
"text": "Margaret",
"leadingIconCss": "margaret"
}
]}, '#chip');
<!DOCTYPE html>
<html lang="en">
<head>
<title>EJ2 Chip</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Typescript UI Controls" />
<meta name="author" content="Syncfusion" />
<link href="//cdn.syncfusion.com/ej2/20.4.48/ej2-buttons/styles/material.css" rel="stylesheet" />
<link href="//cdn.syncfusion.com/ej2/20.4.48/ej2-base/styles/material.css" rel="stylesheet" />
<link href="styles.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
</head>
<body>
<div id='loader'>LOADING....</div>
<div id='container'>
<div id="chip"></div>
</div>
</body>
</html>
#loader {
color: #008cff;
height: 40px;
width: 30%;
position: absolute;
font-family: 'Helvetica Neue','calibiri';
font-size:16px;
top: 45%;
left: 45%;
}
#chip .andrew {
background-image: url('https://ej2.syncfusion.com/demos/src/chips/images/andrew.png')
}
#chip .margaret {
background-image: url('https://ej2.syncfusion.com/demos/src/chips/images/margaret.png')
}
#chip .laura {
background-image: url('https://ej2.syncfusion.com/demos/src/chips/images/laura.png')
}
#chip .janet {
background-image: url('https://ej2.syncfusion.com/demos/src/chips/images/janet.png')
}
You can add and customize the avatar of chip using the avatarIconCss
property.
import { ChipList } from '@syncfusion/ej2-buttons';
new ChipList({chips: [{
"text": "Anne",
"avatarIconCss": "andrew"
},
{
"text": "Janet",
"avatarIconCss": "janet"
},
{
"text": "Laura",
"avatarIconCss": "laura"
},
{
"text": "Margaret",
"avatarIconCss": "margaret"
}
]}, '#chip');
<!DOCTYPE html>
<html lang="en">
<head>
<title>EJ2 Chip</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Typescript UI Controls" />
<meta name="author" content="Syncfusion" />
<link href="//cdn.syncfusion.com/ej2/20.4.48/ej2-buttons/styles/material.css" rel="stylesheet" />
<link href="//cdn.syncfusion.com/ej2/20.4.48/ej2-base/styles/material.css" rel="stylesheet" />
<link href="styles.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
</head>
<body>
<div id='loader'>LOADING....</div>
<div id='container'>
<div id="chip"></div>
</div>
</body>
</html>
#loader {
color: #008cff;
height: 40px;
width: 30%;
position: absolute;
font-family: 'Helvetica Neue','calibiri';
font-size:16px;
top: 45%;
left: 45%;
}
#chip .andrew {
background-image: url('https://ej2.syncfusion.com/demos/src/chips/images/andrew.png')
}
#chip .margaret {
background-image: url('https://ej2.syncfusion.com/demos/src/chips/images/margaret.png')
}
#chip .laura {
background-image: url('https://ej2.syncfusion.com/demos/src/chips/images/laura.png')
}
#chip .janet {
background-image: url('https://ej2.syncfusion.com/demos/src/chips/images/janet.png')
}
You can add and customize the avatar content of chip using the avatarText
property.
import { ChipList } from '@syncfusion/ej2-buttons';
new ChipList({chips: [{
"text": "Anne",
"avatarText": "A"
},
{
"text": "Janet",
"avatarText": "J"
},
{
"text": "Laura",
"avatarText": "L"
},
{
"text": "Margaret",
"avatarText": "M"
}
]}, '#chip');
<!DOCTYPE html>
<html lang="en">
<head>
<title>EJ2 Chip</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Typescript UI Controls" />
<meta name="author" content="Syncfusion" />
<link href="//cdn.syncfusion.com/ej2/20.4.48/ej2-buttons/styles/material.css" rel="stylesheet" />
<link href="//cdn.syncfusion.com/ej2/20.4.48/ej2-base/styles/material.css" rel="stylesheet" />
<link href="styles.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
</head>
<body>
<div id='loader'>LOADING....</div>
<div id='container'>
<div id="chip"></div>
</div>
</body>
</html>
#loader {
color: #008cff;
height: 40px;
width: 30%;
position: absolute;
font-family: 'Helvetica Neue','calibiri';
font-size:16px;
top: 45%;
left: 45%;
}
#chip .andrew {
background-image: url('https://ej2.syncfusion.com/demos/src/chips/images/andrew.png')
}
#chip .margaret {
background-image: url('https://ej2.syncfusion.com/demos/src/chips/images/margaret.png')
}
#chip .laura {
background-image: url('https://ej2.syncfusion.com/demos/src/chips/images/laura.png')
}
#chip .janet {
background-image: url('https://ej2.syncfusion.com/demos/src/chips/images/janet.png')
}
You can add and customize the trailing icon of chip using the trailingIconCss
property.
import { ChipList } from '@syncfusion/ej2-buttons';
new ChipList({chips: [{
"text": "Anne",
"trailingIconCss": "e-dlt-btn"
},
{
"text": "Janet",
"trailingIconCss": "e-dlt-btn"
},
{
"text": "Laura",
"trailingIconCss": "e-dlt-btn"
},
{
"text": "Margaret",
"trailingIconCss": "e-dlt-btn"
}
]}, '#chip');
<!DOCTYPE html>
<html lang="en">
<head>
<title>EJ2 Chip</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Typescript UI Controls" />
<meta name="author" content="Syncfusion" />
<link href="//cdn.syncfusion.com/ej2/20.4.48/ej2-buttons/styles/material.css" rel="stylesheet" />
<link href="//cdn.syncfusion.com/ej2/20.4.48/ej2-base/styles/material.css" rel="stylesheet" />
<link href="styles.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
</head>
<body>
<div id='loader'>LOADING....</div>
<div id='container'>
<div id="chip"></div>
</div>
</body>
</html>
#loader {
color: #008cff;
height: 40px;
width: 30%;
position: absolute;
font-family: 'Helvetica Neue','calibiri';
font-size:16px;
top: 45%;
left: 45%;
}
#chip .andrew {
background-image: url('https://ej2.syncfusion.com/demos/src/chips/images/andrew.png')
}
#chip .margaret {
background-image: url('https://ej2.syncfusion.com/demos/src/chips/images/margaret.png')
}
#chip .laura {
background-image: url('https://ej2.syncfusion.com/demos/src/chips/images/laura.png')
}
#chip .janet {
background-image: url('https://ej2.syncfusion.com/demos/src/chips/images/janet.png')
}
Outline chip has the border with the background transparent. It can be set using the cssClass
property.
import { ChipList } from '@syncfusion/ej2-buttons';
new ChipList({chips: ['Chai', 'Chang', 'Aniseed Syrup ', 'Ikura'],
cssClass: 'e-outline'}, '#chip');
<!DOCTYPE html>
<html lang="en">
<head>
<title>EJ2 Chip</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Typescript UI Controls" />
<meta name="author" content="Syncfusion" />
<link href="//cdn.syncfusion.com/ej2/20.4.48/ej2-buttons/styles/material.css" rel="stylesheet" />
<link href="//cdn.syncfusion.com/ej2/20.4.48/ej2-base/styles/material.css" rel="stylesheet" />
<link href="styles.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
</head>
<body>
<div id='loader'>LOADING....</div>
<div id='container'>
<div id="chip"></div>
</div>
</body>
</html>
#loader {
color: #008cff;
height: 40px;
width: 30%;
position: absolute;
font-family: 'Helvetica Neue','calibiri';
font-size:16px;
top: 45%;
left: 45%;
}
#chip .andrew {
background-image: url('https://ej2.syncfusion.com/demos/src/chips/images/andrew.png')
}
#chip .margaret {
background-image: url('https://ej2.syncfusion.com/demos/src/chips/images/margaret.png')
}
#chip .laura {
background-image: url('https://ej2.syncfusion.com/demos/src/chips/images/laura.png')
}
#chip .janet {
background-image: url('https://ej2.syncfusion.com/demos/src/chips/images/janet.png')
}