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 project.
Use this example to create a simple and versatile badge component.
The Chip component comes with 19 different colors that you can change it using the color class, below there are some examples of the colors
Use this example to create a simple and versatile badge component.
You can make a chip dismissible by adding the data-dismissible="chipName"
data attribute to the chip element and the data-dismissible-target="chipName"
data attribute to the element that you want to close the chip with.
Use the example below for a chip containing an avatar.
Tania Andrew
The following data attributes are available for chip element.
Attribute | Description |
---|---|
data-dismissible | Set the chip dismissible name, it should be the same as the data-dismissible-target data attribute. |
The following data attributes are available for chip trigger element (The element that you want to close the chip with).
Attribute | Description |
---|---|
data-dismissible-target | Hide the chip element that has the same value of data-dismissible-target data attribute for it's data-dismissible data attribute. |
The chip component needs a required script file to work, you just need to add the below script file to the bottom of your html file.
<!-- from node_modules -->
<script src="node_modules/@material-tailwind/html@latest/scripts/dismissible.js"></script>
<!-- from cdn -->
<script src="https://unpkg.com/@material-tailwind/html@latest/scripts/dismissible.js"></script>