Chips / Tags - 图1

Chip Vue Component

Chips (Tags) Vue component represent complex entities in small blocks, such as a contact. They can contain a photo, short title string, and brief information

Chip Components

There are following components included:

  • **f7-chip**

Chip Properties

PropTypeDefaultDescription
<f7-chip> properties
textstringChip label text
mediastringText content of chip media
media-bg-colorstringChip media element background color. One of the default colors
media-text-colorstringChip media element text color. One of the default colors
deleteablebooleanfalseDefines whether the Chip has additional “delete” button or not
outlinebooleanfalseMakes Card outline

Chip Events

EventDescription
<f7-chip> events
clickEvent will be triggered on Chip click
deleteEvent will be triggered on Chip delete button click

Chip Slots

Chip Vue component has additional slots for custom elements:

  • **text** - element will be inserted in place of chip text label
  • **media** - element will be inserted in the chip’s media element

Examples

  1. <template>
  2. <f7-page>
  3. <f7-navbar title="Chips"></f7-navbar>
  4. <f7-block-title>Chips With Text</f7-block-title>
  5. <f7-block strong>
  6. <f7-chip text="Example Chip"></f7-chip>
  7. <f7-chip text="Another Chip"></f7-chip>
  8. <f7-chip text="One More Chip"></f7-chip>
  9. <f7-chip text="Fourth Chip"></f7-chip>
  10. <f7-chip text="Last One"></f7-chip>
  11. </f7-block>
  12. <f7-block-title>Outline Chips</f7-block-title>
  13. <f7-block strong>
  14. <f7-chip outline text="Example Chip"></f7-chip>
  15. <f7-chip outline text="Another Chip"></f7-chip>
  16. <f7-chip outline text="One More Chip"></f7-chip>
  17. <f7-chip outline text="Fourth Chip"></f7-chip>
  18. <f7-chip outline text="Last One"></f7-chip>
  19. </f7-block>
  20. <f7-block-title>Icon Chips</f7-block-title>
  21. <f7-block strong>
  22. <f7-chip text="Add Contact" media-bg-color="blue">
  23. <f7-icon slot="media" ios="f7:add_round" md="material:add_circle"></f7-icon>
  24. </f7-chip>
  25. <f7-chip text="London" media-bg-color="green">
  26. <f7-icon slot="media" ios="f7:compass" md="material:location_on"></f7-icon>
  27. </f7-chip>
  28. <f7-chip text="John Doe" media-bg-color="red">
  29. <f7-icon slot="media" ios="f7:person" md="material:person"></f7-icon>
  30. </f7-chip>
  31. </f7-block>
  32. <f7-block-title>Contact Chips</f7-block-title>
  33. <f7-block strong>
  34. <f7-chip text="Jane Doe">
  35. <img slot="media" src="http://lorempixel.com/100/100/people/9/"/>
  36. </f7-chip>
  37. <f7-chip text="John Doe">
  38. <img slot="media" src="http://lorempixel.com/100/100/people/3/"/>
  39. </f7-chip>
  40. <f7-chip text="Adam Smith">
  41. <img slot="media" src="http://lorempixel.com/100/100/people/7/"/>
  42. </f7-chip>
  43. <f7-chip text="Jennifer" media-bg-color="pink" media="J"></f7-chip>
  44. <f7-chip text="Chris" media-bg-color="yellow" media-text-color="black" media="C"></f7-chip>
  45. <f7-chip text="Kate" media-bg-color="red" media="K"></f7-chip>
  46. </f7-block>
  47. <f7-block-title>Deletable Chips / Tags</f7-block-title>
  48. <f7-block strong>
  49. <f7-chip text="Example Chip" deleteable @click="deleteChip"></f7-chip>
  50. <f7-chip text="Chris" media="C" media-bg-color="orange" text-color="black" deleteable @click="deleteChip"></f7-chip>
  51. <f7-chip text="Jane Doe" deleteable @click="deleteChip">
  52. <img slot="media" src="http://lorempixel.com/100/100/people/9/"/>
  53. </f7-chip>
  54. <f7-chip text="One More Chip" deleteable @click="deleteChip"></f7-chip>
  55. <f7-chip text="Jennifer" media-bg-color="pink" media="J" deleteable @click="deleteChip"></f7-chip>
  56. <f7-chip text="Adam Smith" deleteable @click="deleteChip">
  57. <img slot="media" src="http://lorempixel.com/100/100/people/7/"/>
  58. </f7-chip>
  59. </f7-block>
  60. <f7-block-title>Color Chips</f7-block-title>
  61. <f7-block strong>
  62. <f7-chip text="Red Chip" color="red"></f7-chip>
  63. <f7-chip text="Green Chip" color="green"></f7-chip>
  64. <f7-chip text="Blue Chip" color="blue"></f7-chip>
  65. <f7-chip text="Orange Chip" color="orange"></f7-chip>
  66. <f7-chip text="Pink Chip" color="pink"></f7-chip>
  67. <f7-chip outline text="Red Chip" color="red"></f7-chip>
  68. <f7-chip outline text="Green Chip" color="green"></f7-chip>
  69. <f7-chip outline text="Blue Chip" color="blue"></f7-chip>
  70. <f7-chip outline text="Orange Chip" color="orange"></f7-chip>
  71. <f7-chip outline text="Pink Chip" color="pink"></f7-chip>
  72. </f7-block>
  73. </f7-page>
  74. </template>
  75. <script>
  76. export default {
  77. methods: {
  78. deleteChip(e) {
  79. const $$ = this.$$;
  80. const app = this.$f7;
  81. const target = e.target;
  82. app.dialog.confirm('Do you want to delete this tiny demo Chip?', () => {
  83. $$(target).parents('.chip').remove();
  84. });
  85. },
  86. },
  87. };
  88. </script>