{"id":20934906,"url":"https://github.com/fouita/svelte-tw-chip","last_synced_at":"2026-05-06T09:32:31.479Z","repository":{"id":129139212,"uuid":"296620129","full_name":"fouita/svelte-tw-chip","owner":"fouita","description":"Chip component built with svelte and tailwindcss, can be used as alert","archived":false,"fork":false,"pushed_at":"2020-09-18T12:54:13.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-19T19:56:03.357Z","etag":null,"topics":["chip","fouita","svelte","tailwindcss"],"latest_commit_sha":null,"homepage":"","language":"Svelte","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fouita.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2020-09-18T12:51:13.000Z","updated_at":"2020-09-18T14:15:06.000Z","dependencies_parsed_at":"2023-03-17T22:30:52.344Z","dependency_job_id":null,"html_url":"https://github.com/fouita/svelte-tw-chip","commit_stats":null,"previous_names":["fouita/chip"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fouita%2Fsvelte-tw-chip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fouita%2Fsvelte-tw-chip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fouita%2Fsvelte-tw-chip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fouita%2Fsvelte-tw-chip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fouita","download_url":"https://codeload.github.com/fouita/svelte-tw-chip/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243330266,"owners_count":20274037,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chip","fouita","svelte","tailwindcss"],"created_at":"2024-11-18T22:11:54.574Z","updated_at":"2025-12-25T09:49:06.165Z","avatar_url":"https://github.com/fouita.png","language":"Svelte","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Svelte and Tailwindcss Chip component\n\nChip and alert component built with svelte and tailwindcss\n\n# Installation\n\n```bash\n$npm i -D @fouita/chip\n```\n\n# Usage\n\nYou can use this component as a simple chip (label) or as an alert.\n\n![fouita chip](https://cdn.fouita.com/assets/pics/template/chip/chip-simple.jpg)\n\n```html\n\u003cscript\u003e\n\timport Chip from '@fouita/chip'\n\u003c/script\u003e\n\n\u003cdiv class=\"flex items-center\"\u003e\n\t\u003cChip class=\"m-5\" \u003eSimple chip\u003c/Chip\u003e\n\u003c/div\u003e\n```\n\n\n## Changing size \u0026 color\n\nTo change size you can use tailwind size scale `xs, sm, md, lg, xl`, same goes for colors `red, blue, yellow, orange, indigo, pink, purple, gray, green, teal`.\n\nYou can use `outline` to change the background with lighter color and make the text darker \n\n![fouita chip](https://cdn.fouita.com/assets/pics/template/chip/chip-size-color.jpg)\n\n\n```html\n\u003cdiv class=\"flex items-end\"\u003e\n\t\t\n\t\u003cChip color=red \u003e\tHello! \u003c/Chip\u003e\n\t\u003cChip outline size=sm color=indigo\u003e\tHello! \u003c/Chip\u003e\n\t\u003cChip size=md color=teal\u003e\tHello! \u003c/Chip\u003e\n\t\u003cChip outline size=lg color=pink\u003e\tHello! \u003c/Chip\u003e\n\t\n\u003c/div\u003e\n```\n\n\n## Change rounding\n\nYou can use change the rounding of the Chip component by using the `rounded` prop and tailwindcss rounded options `none, sm, md, lg, full`\n\n![fouita chip](https://cdn.fouita.com/assets/pics/template/chip/chip-rounded.jpg)\n\n```html\n\u003cdiv key=k1 class=\"flex items-end\"\u003e\n\t\t\n\t\u003cChip color=red rounded=none \u003e\tHello! \u003c/Chip\u003e\n\t\u003cChip outline color=indigo rounded=sm\u003e\tHello! \u003c/Chip\u003e\n\t\u003cChip color=teal rounded=md\u003e\tHello! \u003c/Chip\u003e\n\t\u003cChip outline  color=pink rounded=lg\u003e\tHello! \u003c/Chip\u003e\n\t\u003cChip color=yellow rounded=full\u003e\tHello! \u003c/Chip\u003e\n\t\n\u003c/div\u003e\n```\n\n\n## Closing a Chip\n\nTo close a Chip you need to pass `onDelete` prop with close method, like the follwoing. You can also choose the fade duration (in ms) when closing by adding `tr_duration={N}` , `N=200` by default\n\n![fouita chip](https://cdn.fouita.com/assets/pics/template/chip/chip-close.jpg)\n\n```html\n\u003cscript\u003e\n\timport Chip from '@fouita/chip'\n\tlet show_chip = true\n\tfunction removeChip(){\n\t\tshow_chip = false\n\t}\n\u003c/script\u003e\n\n\u003cdiv key=k1 class=\"flex items-end p-5\"\u003e\n\t\n\t{#if show_chip}\t\n\t\t\u003cChip color=red rounded=none onDelete={removeChip} tr_duration={500}\u003e\t\n            Hello! \n        \u003c/Chip\u003e\n\t{/if}\n\t\n\u003c/div\u003e\n```\n\n\n## Add avatar or custom icon\n\nTo add an avatar we can use `@fouita/avatar` , see more on how to use [fouita avatar](https://dev.to/haynajjar/svelte-tailwindcss-avatar-component-33g8)\n\n![fouita chip](https://cdn.fouita.com/assets/pics/template/chip/chip-avatar.jpg)\n\n\n```html\n\u003cscript\u003e\n\timport Avatar from '@fouita/avatar'\n\timport Chip from '@fouita/chip'\n\timport {HeartIcon} from 'svelte-feather-icons'\n\u003c/script\u003e\n\n\u003cdiv class=\"flex flex-wrap p-6\"\u003e\n\t\u003cChip outline size=sm rounded=lg color=purple\u003e\t\n\t\t\u003cdiv slot=avatar\u003e\n\t\t\t\u003cAvatar size=6 rounded src=\"https://randomuser.me/api/portraits/women/68.jpg\" class=\"ml-0 my-0 text-xs rounded-lg\" /\u003e\n\t\t\u003c/div\u003e\n\t\tHello! \n\t\u003c/Chip\u003e\n\t\n\t\u003cChip color=red size=sm rounded=full\u003e\t\n\t\t\u003cdiv slot=avatar\u003e\n\t\t\t\u003cHeartIcon class='w-4 h-4 mr-2' /\u003e\n\t\t\u003c/div\u003e\n\t\tHello! \n\t\u003c/Chip\u003e\n\u003c/div\u003e\n```\n\n\n\n## Alerts examples\n\nTo use the chip as alerts, here is an example on how you can achieve that!\n\n![fouita chip](https://cdn.fouita.com/assets/pics/template/chip/chip-alert.jpg)\n\n\n```html\n\u003cscript\u003e\n  import Chip from \"@fouita/chip\";\n  import {\n    AlertOctagonIcon,\n    InfoIcon,\n    CheckCircleIcon\n  } from \"svelte-feather-icons\";\n\n  let alerts = {\n    error1: true,\n    error2: true,\n    info1: true,\n    info2: true,\n    success1: true,\n    success2: true\n  };\n\n  function remove(key) {\n    alerts[key] = false;\n  }\n\u003c/script\u003e\n\n\u003cdiv\u003e\n  {#if alerts['error1']}\n    \u003cChip\n      outline\n      rounded=md\n      color=red\n      size=xl\n      onDelete={() =\u003e remove('error1')}\n    \u003e\n      \u003cdiv slot=avatar\u003e\n        \u003cAlertOctagonIcon class=\"w-5 h-5 mx-2\" /\u003e\n      \u003c/div\u003e\n      There is an error in your code\n    \u003c/Chip\u003e\n  {/if}\n\n  {#if alerts['error2']}\n    \u003cChip\n      rounded=md\n      color=red\n      size=xl\n      onDelete={() =\u003e remove('error2')}\n    \u003e\n      \u003cdiv slot=avatar\u003e\n        \u003cAlertOctagonIcon class=\"w-5 h-5 mx-2\" /\u003e\n      \u003c/div\u003e\n      There is an error in your code\n    \u003c/Chip\u003e\n  {/if}\n\n  \u003cdiv class=\"mt-4\"\u003e\u003c/div\u003e\n  {#if alerts['info1']}\n    \u003cChip\n      outline\n      rounded=md\n      color=yellow\n      size=xl\n      onDelete={() =\u003e remove('info1')}\n    \u003e\n      \u003cdiv slot=avatar\u003e\n        \u003cInfoIcon class=\"w-5 h-5 mx-2\" /\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"py-2\"\u003e\n        This is an info message\n        \u003cdiv class=\"text-sm font-base\"\u003e\n          More information about the message can be found\n          \u003ca href=\"/#\"\u003ehere\u003c/a\u003e\n        \u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/Chip\u003e\n  {/if}\n\n  {#if alerts['info2']}\n    \u003cChip\n      rounded=md\n      color=yellow\n      size=xl\n      onDelete={() =\u003e remove('info2')}\n    \u003e\n      \u003cdiv slot=avatar\u003e\n        \u003cInfoIcon class=\"w-5 h-5 mx-2\" /\u003e\n      \u003c/div\u003e\n      This is an info message\n    \u003c/Chip\u003e\n  {/if}\n\n  \u003cdiv class=\"mt-4\"\u003e\u003c/div\u003e\n  {#if alerts['success1']}\n    \u003cChip\n      outline\n      rounded=md\n      color=green\n      size=xl\n      onDelete={() =\u003e remove('success1')}\n    \u003e\n      \u003cdiv slot=avatar\u003e\n        \u003cCheckCircleIcon class=\"w-5 h-5 mx-2\" /\u003e\n      \u003c/div\u003e\n      This is a success messsage\n    \u003c/Chip\u003e\n  {/if}\n\n  {#if alerts['success2']}\n    \u003cChip\n      rounded=md\n      color=green\n      size=xl\n      onDelete={() =\u003e remove('success2')}\n    \u003e\n      \u003cdiv slot=avatar\u003e\n        \u003cCheckCircleIcon class=\"w-5 h-5 mx-2\" /\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"py-2\"\u003e\n        This is a success messsage\n        \u003cdiv class=\"text-sm font-base\"\u003e\n          More information about the message can be found\n          \u003ca href=\"/#\"\u003ehere\u003c/a\u003e\n        \u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/Chip\u003e\n  {/if}\n\n\u003c/div\u003e\n\n```\n\n\n\n## About\n\n[Fouita : UI framework for svelte + tailwind components](https://fouita.com)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffouita%2Fsvelte-tw-chip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffouita%2Fsvelte-tw-chip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffouita%2Fsvelte-tw-chip/lists"}