Get started on your web projects with our Tailwind CSS Chip which is a compact elements that represent an input, attribute, or action. This element appears dynamically as a group of multiple interactive elements and allows users to enter information, make selections, filter content, or trigger actions
See below our simple Chip component example that you can use for your Tailwind CSS and Angular project. The example also comes in different styles and colors, so you can adapt it easily to your needs.
You first need to import the DUIChip
Module into your application module
Code
import { DUIChip } from "david-ui-angular"; @NgModule({ declarations: [AppComponent], imports: [BrowserModule, DUIChip], providers: [], bootstrap: [AppComponent], }) export class AppModule {}
Preview
Code
<dui-chip>Chip</dui-chip>
The Chip
component comes with 4 different variants that you can change it using the variant
prop.
Preview
Code
<dui-chip variant="filled" >Chip Filled</dui-chip> <dui-chip variant="outlined" >Chip Outlined</dui-chip> <dui-chip variant="gradient" >Chip Gradient</dui-chip> <dui-chip variant="ghost" >Chip Ghost</dui-chip>
The Chip
component comes with 3 different sizes that you can change it using the size
prop.
Preview
Code
<dui-chip size="sm" >Chip Filled</dui-chip> <dui-chip size="md" >Chip Filled</dui-chip> <dui-chip size="lg" >Chip Filled</dui-chip>
You can use different colors of the chip component by manipulating the color attribute of the component
Preview
Code
<dui-chip color="red">Chip</dui-chip> <dui-chip color="yellow">Chip</dui-chip> <dui-chip color="green">Chip</dui-chip> <dui-chip color="pink">Chip</dui-chip> <dui-chip color="purple">Chip</dui-chip>
You can pass tailwind css classes for the Chip
component using the className
prop this helps to do any sort of customization for the chip.
Preview
Code
<dui-chip variant="filled" className="rounded-full">Chip Filled</dui-chip> <dui-chip variant="outlined" className="rounded-full" >Chip Outlined</dui-chip> <dui-chip variant="gradient" className="rounded-full" >Chip Gradient</dui-chip> <dui-chip variant="ghost" className="rounded-full" >Chip Ghost</dui-chip>
You can use different colors of the chip component by manipulating the color attribute of the component
Preview
Code
<dui-chip color="gray" variant="filled" [hasIcon]="true" > <dui-icon> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="h-5 w-5" > <path fillRule="evenodd" d="M18.685 19.097A9.723 9.723 0 0021.75 12c0-5.385-4.365-9.75-9.75-9.75S2.25 6.615 2.25 12a9.723 9.723 0 003.065 7.097A9.716 9.716 0 0012 21.75a9.716 9.716 0 006.685-2.653zm-12.54-1.285A7.486 7.486 0 0112 15a7.486 7.486 0 015.855 2.812A8.224 8.224 0 0112 20.25a8.224 8.224 0 01-5.855-2.438zM15.75 9a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0z" clipRule="evenodd" /> </svg> </dui-icon> Account </dui-chip> <dui-chip color="gray" variant="gradient" [hasIcon]="true" > <dui-icon> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="h-5 w-5" > <path fillRule="evenodd" d="M18.685 19.097A9.723 9.723 0 0021.75 12c0-5.385-4.365-9.75-9.75-9.75S2.25 6.615 2.25 12a9.723 9.723 0 003.065 7.097A9.716 9.716 0 0012 21.75a9.716 9.716 0 006.685-2.653zm-12.54-1.285A7.486 7.486 0 0112 15a7.486 7.486 0 015.855 2.812A8.224 8.224 0 0112 20.25a8.224 8.224 0 01-5.855-2.438zM15.75 9a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0z" clipRule="evenodd" /> </svg> </dui-icon> Account </dui-chip> <dui-chip color="gray" variant="outlined" [hasIcon]="true" > <dui-icon> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="h-5 w-5" > <path fillRule="evenodd" d="M18.685 19.097A9.723 9.723 0 0021.75 12c0-5.385-4.365-9.75-9.75-9.75S2.25 6.615 2.25 12a9.723 9.723 0 003.065 7.097A9.716 9.716 0 0012 21.75a9.716 9.716 0 006.685-2.653zm-12.54-1.285A7.486 7.486 0 0112 15a7.486 7.486 0 015.855 2.812A8.224 8.224 0 0112 20.25a8.224 8.224 0 01-5.855-2.438zM15.75 9a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0z" clipRule="evenodd" /> </svg> </dui-icon> Account </dui-chip> <dui-chip color="gray" variant="ghost" [hasIcon]="true" > <dui-icon> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="h-5 w-5" > <path fillRule="evenodd" d="M18.685 19.097A9.723 9.723 0 0021.75 12c0-5.385-4.365-9.75-9.75-9.75S2.25 6.615 2.25 12a9.723 9.723 0 003.065 7.097A9.716 9.716 0 0012 21.75a9.716 9.716 0 006.685-2.653zm-12.54-1.285A7.486 7.486 0 0112 15a7.486 7.486 0 015.855 2.812A8.224 8.224 0 0112 20.25a8.224 8.224 0 01-5.855-2.438zM15.75 9a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0z" clipRule="evenodd" /> </svg> </dui-icon> Account </dui-chip>
The following properties are available for dui-chip
Attribute | Type | Description | Default |
---|---|---|---|
variant | Variant | change chip variant | filled |
color | Color | change chip color | gray |
className | string | Add custom className for chip | '' |
size | boolean | Change chip size | md |
isDismissible | boolean | Dismissible flag for chip | false |
hasIcon | boolean | Icon flag for chip | false |
<dui-icon> | content | Add Icon content inside dui-icon tag to use icon in chip | false |