Files
flowbite-vue/docs/components/badge.md
Ilya Artamonov d316cf3a12 Components renaming (#225)
* refactor: eslint config adjusted for better diff's

* refactor: stricter linting
 + dependencies updated

* refactoring: paragraph component
 - component
 - docs

* refactoring: heading component
 - component
 - docs

* Update docs/components/heading.md

Co-authored-by: Ilya Artamonov <ilya.sosidka@gmail.com>

* refactoring: link component
 - component
 - docs

* refactoring: image component
 - component
 - docs

* refactoring: alert component
 - component
 - docs

* refactoring: avatar component
 - component
 - docs

* refactoring: removed unnecessary code
    - component names come from the file name

* refactoring: breadcrumb component
 - component
 - docs

* refactoring: accordion component
 - component
 - docs

* refactoring: buttom component
 - component
 - docs

* refactoring: badge component
 - component
 - docs

* refactoring: card component
 - component
 - docs

* refactoring: order of components in docs updated

* refactoring: unnecessary semicolons removed

* refactoring: button group component
 - component
 - docs

* refactoring: carousel component
 - component
 - docs

* refactoring: dropdown component
 - component
 - docs

* refactoring: footer component
 - component
 - docs

* refactoring:list-group component
 - component
 - docs

* refactoring: modal component
 - component
 - docs

* refactoring: navbar component
 - component
 - docs

* refactoring: pagination component
 - component
 - docs

* refactoring: progress component
 - component
 - docs

* refactoring: rating component
 - component
 - docs

* refactoring: spinner component
 - component
 - docs

* refactoring: table component
 - component
 - docs

* refactoring: tabs component
 - component
 - docs

* feat: Updated pagination examples

* lint: Lister fixes

* feat: Sidebar component and some fixes

* feat: Input component

* feat: Some fixes

* feat: Some fixes

* chore: update deps

* refactor: removed old Modal component

* refactor: radio component and some fixes

* fix: fixed path error

* refactor: Range component

* refactoring: timeline component
 - component
 - docs

* refactor: Select component

* refactoring: toast component
 - component
 - docs

* refactoring: tooltip component
 - component
 - docs

* refactoring: sidebar component
 - component
 - docs

* refactoring: input component
 - component
 - docs

* refactoring: fileInput component
 - component
 - docs

* refactoring: select component
 - component
 - docs

* refactoring: textarea component
 - component
 - docs

* refactoring: checkbox component
 - component
 - docs

* refactoring: radio component
 - component
 - docs

* refactoring: toggle component
 - component
 - docs

* refactoring: range component
 - component
 - docs

* local configs linted

* documentation quick start updated

* flowbite-themable refactored to fit new linters and style guide

* random linter fixes

* refactoring: toast-provider component
 - component
 - docs

* final linter fixes

* lint: Linter fixes

* fix: Fixed types

* fix: Fixed card component

* docs: Updated card examples

* fix: Fixed tabs

* refactor: Heading component refactoring

* Fwb rename - few fixes after component review (#237)

* fix: button documentation

* fix: model type in range examples

* chore: Toast marked as WIP

---------

Co-authored-by: Sqrcz <naorniakowski@slashlab.pl>
Co-authored-by: Sqrcz <naorniakowski@gmail.com>
2023-10-23 18:23:14 +03:00

144 lines
4.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<script setup>
import FwbBadgeExample from './badge/examples/FwbBadgeExample.vue'
import FwbBadgeExampleSize from './badge/examples/FwbBadgeExampleSize.vue'
import FwbBadgeExampleLink from './badge/examples/FwbBadgeExampleLink.vue'
import FwbBadgeExampleIcon from './badge/examples/FwbBadgeExampleIcon.vue'
import FwbBadgeExampleIconOnly from './badge/examples/FwbBadgeExampleIconOnly.vue'
</script>
# Vue Badge - Flowbite
#### Use Tailwind CSS badges as elements to show counts or labels separately or inside other components
---
:::tip
Original reference: [https://flowbite.com/docs/components/badge/](https://flowbite.com/docs/components/badge/)
:::
The badge component can be used to complement other elements such as buttons or text elements as a label or to show the count of a given data, such as the number of comments for an article or how much time has passed by since a comment has been made.
Alternatively, badges can also be used as standalone elements that link to a certain page by using the anchor tag instead of a span element.
## Default badge
Prop type
<fwb-badge-example />
```vue
<template>
<fwb-badge>Default</fwb-badge>
<fwb-badge type="dark">Dark</fwb-badge>
<fwb-badge type="red">Red</fwb-badge>
<fwb-badge type="green">Green</fwb-badge>
<fwb-badge type="yellow">Yellow</fwb-badge>
<fwb-badge type="indigo">Indigo</fwb-badge>
<fwb-badge type="purple">Purple</fwb-badge>
<fwb-badge type="pink">Pink</fwb-badge>
</template>
<script setup>
import { FwbBadge } from 'flowbite-vue'
</script>
```
## Large badges
Prop size
<fwb-badge-example-size />
```vue
<template>
<fwb-badge size="xs">Default</fwb-badge>
<fwb-badge size="xs" type="dark">Dark</fwb-badge>
<fwb-badge size="xs" type="red">Red</fwb-badge>
<fwb-badge size="xs" type="green">Green</fwb-badge>
<fwb-badge size="sm" type="yellow">Yellow</fwb-badge>
<fwb-badge size="sm" type="indigo">Indigo</fwb-badge>
<fwb-badge size="sm" type="purple">Purple</fwb-badge>
<fwb-badge size="sm" type="pink">Pink</fwb-badge>
</template>
<script setup>
import { FwbBadge } from 'flowbite-vue'
</script>
```
## Badges as links
You can also use badges as anchor elements to link to another page.
Prop href
<fwb-badge-example-link />
```vue
<template>
<fwb-badge href="#">
Link
</fwb-badge>
<fwb-badge href="#" size="sm">
Link small
</fwb-badge>
</template>
<script setup>
import { FwbBadge } from 'flowbite-vue'
</script>
```
## Badges with icon
You can also use SVG icons inside the badge elements.
slot icon
<fwb-badge-example-icon />
```vue
<template>
<fwb-badge>
<template #icon>
<svg aria-hidden="true" class="mr-1 w-3 h-3" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
<path clip-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm1-12a1 1 0 10-2 0v4a1 1 0 00.293.707l2.828 2.829a1 1 0 101.415-1.415L11 9.586V6z" fill-rule="evenodd" />
</svg>
</template>
Default
</fwb-badge>
<fwb-badge size="sm" type="dark">
<template #icon>
<svg aria-hidden="true" class="mr-1 w-3 h-3" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
<path clip-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm1-12a1 1 0 10-2 0v4a1 1 0 00.293.707l2.828 2.829a1 1 0 101.415-1.415L11 9.586V6z" fill-rule="evenodd" />
</svg>
</template>
Dark
</fwb-badge>
</template>
<script setup>
import { FwbBadge } from 'flowbite-vue'
</script>
```
## Badge with icon only
<fwb-badge-example-icon-only />
```vue
<template>
<fwb-badge>
<template #icon>
<svg aria-hidden="true" class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
<path clip-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm1-12a1 1 0 10-2 0v4a1 1 0 00.293.707l2.828 2.829a1 1 0 101.415-1.415L11 9.586V6z" fill-rule="evenodd" />
</svg>
</template>
</fwb-badge>
<fwb-badge type="dark">
<template #icon>
<svg aria-hidden="true" class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
<path clip-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm1-12a1 1 0 10-2 0v4a1 1 0 00.293.707l2.828 2.829a1 1 0 101.415-1.415L11 9.586V6z" fill-rule="evenodd" />
</svg>
</template>
</fwb-badge>
<fwb-badge size="sm" type="green">
<template #icon>
<svg aria-hidden="true" class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
<path clip-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm1-12a1 1 0 10-2 0v4a1 1 0 00.293.707l2.828 2.829a1 1 0 101.415-1.415L11 9.586V6z" fill-rule="evenodd" />
</svg>
</template>
</fwb-badge>
</template>
<script setup>
import { FwbBadge } from 'flowbite-vue'
</script>
```