2024-12-04 15:06:34 +00:00
< script setup >
import Pill from '~/components/ui/Pill.vue'
< / script >
2025-01-10 00:13:17 +00:00
```ts
import Pill from "~/components/ui/Pill.vue"
```
2024-11-26 11:59:11 +00:00
# Pill
Pills are decorative elements that display information about content they attach to. They can be links to other content or simple colored labels.
2024-12-04 15:06:34 +00:00
You can add text to pills by adding it between the `<Pill>` tags.
2024-11-26 11:59:11 +00:00
| Prop | Data type | Required? | Default | Description |
| ------- | ----------------------------------------------------------------------------------------------- | --------- | ----------- | ---------------------- |
| `color` | `primary` \| `secondary` \| `destructive` \| `blue` \| `red` \| `purple` \| `green` \| `yellow` | No | `secondary` | Renders a colored pill |
2025-01-04 11:01:02 +00:00
-> [Let the user create lists of pills ](./pills )
2024-11-26 11:59:11 +00:00
### Primary
Primary pills convey **positive** information.
```vue-html
2024-12-15 23:07:09 +00:00
< Pill primary >
2024-11-26 11:59:11 +00:00
Primary pill
2024-12-04 15:06:34 +00:00
< / Pill >
2024-11-26 11:59:11 +00:00
```
2024-12-15 23:07:09 +00:00
< Pill primary >
2024-11-26 11:59:11 +00:00
Primary pill
2024-12-04 15:06:34 +00:00
< / Pill >
2024-11-26 11:59:11 +00:00
### Secondary
Secondary pills convey **neutral** or simple decorational information such as genre tags.
::: info
This is the default type for pills. If you don't specify a type, a **secondary** pill is rendered.
:::
```vue-html
2024-12-04 15:06:34 +00:00
< Pill >
2024-11-26 11:59:11 +00:00
Secondary pill
2024-12-04 15:06:34 +00:00
< / Pill >
2024-11-26 11:59:11 +00:00
```
2024-12-04 15:06:34 +00:00
< Pill >
2024-11-26 11:59:11 +00:00
Secondary pill
2024-12-04 15:06:34 +00:00
< / Pill >
2024-11-26 11:59:11 +00:00
### Destructive
Destructive pills convey **destructive** or **negative** information. Use these to indicate that information could cause issues such as data loss.
```vue-html
2024-12-15 23:07:09 +00:00
< Pill destructive >
2024-11-26 11:59:11 +00:00
Destructive pill
2024-12-04 15:06:34 +00:00
< / Pill >
2024-11-26 11:59:11 +00:00
```
2024-12-15 23:07:09 +00:00
< Pill destructive >
2024-11-26 11:59:11 +00:00
Destructive pill
2024-12-04 15:06:34 +00:00
< / Pill >
2024-11-26 11:59:11 +00:00
## Pill colors
Funkwhale pills support a range of pastel colors to create visually appealing interfaces.
### Blue
```vue-html
2024-12-15 23:07:09 +00:00
< Pill blue >
2024-11-26 11:59:11 +00:00
Blue pill
2024-12-04 15:06:34 +00:00
< / Pill >
2024-11-26 11:59:11 +00:00
```
2024-12-15 23:07:09 +00:00
< Pill blue >
2024-11-26 11:59:11 +00:00
Blue pill
2024-12-04 15:06:34 +00:00
< / Pill >
2024-11-26 11:59:11 +00:00
### Red
```vue-html
2024-12-15 23:07:09 +00:00
< Pill red >
2024-11-26 11:59:11 +00:00
Red pill
2024-12-04 15:06:34 +00:00
< / Pill >
2024-11-26 11:59:11 +00:00
```
2024-12-15 23:07:09 +00:00
< Pill red >
2024-11-26 11:59:11 +00:00
Red pill
2024-12-04 15:06:34 +00:00
< / Pill >
2024-11-26 11:59:11 +00:00
### Purple
```vue-html
2024-12-15 23:07:09 +00:00
< Pill purple >
2024-11-26 11:59:11 +00:00
Purple pill
2024-12-04 15:06:34 +00:00
< / Pill >
2024-11-26 11:59:11 +00:00
```
2024-12-15 23:07:09 +00:00
< Pill purple >
2024-11-26 11:59:11 +00:00
Purple pill
2024-12-04 15:06:34 +00:00
< / Pill >
2024-11-26 11:59:11 +00:00
### Green
```vue-html
2024-12-15 23:07:09 +00:00
< Pill green >
2024-11-26 11:59:11 +00:00
Green pill
2024-12-04 15:06:34 +00:00
< / Pill >
2024-11-26 11:59:11 +00:00
```
2024-12-15 23:07:09 +00:00
< Pill green >
2024-11-26 11:59:11 +00:00
Green pill
2024-12-04 15:06:34 +00:00
< / Pill >
2024-11-26 11:59:11 +00:00
### Yellow
```vue-html
2024-12-15 23:07:09 +00:00
< Pill yellow >
2024-11-26 11:59:11 +00:00
Yellow pill
2024-12-04 15:06:34 +00:00
< / Pill >
2024-11-26 11:59:11 +00:00
```
2024-12-15 23:07:09 +00:00
< Pill yellow >
2024-11-26 11:59:11 +00:00
Yellow pill
2024-12-04 15:06:34 +00:00
< / Pill >
2024-11-26 11:59:11 +00:00
## Image pills
Image pills contain a small circular image on their left. These can be used for decorative links such as artist links. To created an image pill, insert a link to the image between the pill tags as a `<template>` .
```vue-html{2-4}
2024-12-04 15:06:34 +00:00
< Pill >
2024-11-26 11:59:11 +00:00
< template #image >
< img src = "/images/awesome-artist.png" / >
< / template >
Awesome artist
2024-12-04 15:06:34 +00:00
< / Pill >
2024-11-26 11:59:11 +00:00
```
2024-12-04 15:06:34 +00:00
< Pill >
2024-11-26 11:59:11 +00:00
< template #image >
< div style = "background-color: #0004 " />
< / template >
Awesome artist
2024-12-04 15:06:34 +00:00
< / Pill >