Componentes · Contenido
Etiqueta <Badge>
Etiquetas cortas: estado de una casa, un dato, un número en un círculo.
import Badge from '@vivla-cms/ds/primitives/Badge.astro'Ejemplos
Tonos
neutral (por defecto) es el paso de tarjeta; accent es blanco sobre terracota (4,77:1) y en una banda terracota se invierte; outline es una línea fina; inverse invierte la superficie; glass es el velo translúcido que Figma pinta sobre terracota («ÚLTIMA FRACCIÓN»), elegido por diseño por encima de AA.
---
import Badge from '@vivla-cms/ds/primitives/Badge.astro'
---
<Badge>Nuevo</Badge>
<Badge tone="accent">Última fracción</Badge>
<Badge tone="outline">Ibiza</Badge>
<Badge tone="inverse">1/8 disponible</Badge>
<Badge tone="glass">Próximamente</Badge> Tono × tamaño
En la forma pill (chip de texto en mayúsculas), sm usa text-eyebrow y md text-small. Cambia de tema para ver cómo resuelve cada tono.
neutral Disponible Disponible accent Disponible Disponible outline Disponible Disponible inverse Disponible Disponible glass Disponible Disponible ---
import Badge from '@vivla-cms/ds/primitives/Badge.astro'
const tones = ['neutral', 'accent', 'outline', 'inverse', 'glass'] as const
---
<div class="grid grid-cols-[auto_auto_auto] items-center justify-start gap-x-8 gap-y-4">
<span></span>
<span class="text-small text-on-surface-subtle">sm</span>
<span class="text-small text-on-surface-subtle">md</span>
{
tones.map((tone) => (
<>
<code class="font-mono text-small text-on-surface-muted">{tone}</code>
<span><Badge tone={tone} size="sm">Disponible</Badge></span>
<span><Badge tone={tone} size="md">Disponible</Badge></span>
</>
))
}
</div> Marcadores: círculo y cuadrado
shape="circle" o "square" es una caja fija para UN icono o UN número. sm = 40 → 44 px (el anillo de pasos de Cómo funciona), md = 44 → 56 px (el disco con flecha de destinos), cambian en md. En estas formas outline dibuja el anillo en el color del texto. font="display" pone el número en PP Right Serif. Si va junto a un titular o enlace, es decorativo: aria-hidden="true".
---
import Badge from '@vivla-cms/ds/primitives/Badge.astro'
import Icon from '@vivla-cms/ds/primitives/Icon.astro'
---
<div class="flex flex-wrap items-center gap-4">
{[1, 2, 3, 4].map((n) => (
<Badge shape="circle" tone="outline" size="sm" font="display" aria-hidden="true">{n}</Badge>
))}
<Badge shape="square" tone="outline" size="sm" font="display" aria-hidden="true">5</Badge>
</div>
<div class="flex flex-wrap items-center gap-4">
<Badge shape="circle" tone="inverse" size="md" aria-hidden="true"><Icon name="arrow-up-right" size={36} /></Badge>
<Badge shape="circle" tone="accent" size="md" aria-hidden="true"><Icon name="arrow-up-right" size={32} /></Badge>
<Badge shape="circle" tone="neutral" size="md"><Icon name="plus" size={24} label="Añadir" /></Badge>
<Badge shape="square" tone="glass" size="md" aria-hidden="true"><Icon name="play" size={24} /></Badge>
</div> Sobre la foto de una casa
El uso real de las fichas: estado arriba a la izquierda y fracción. glass toma el color claro del tema con un velo del 15 %, así que va dentro de una zona dark o accent.
---
import Badge from '@vivla-cms/ds/primitives/Badge.astro'
import Media from '@vivla-cms/ds/primitives/Media.astro'
---
<div class="relative max-w-xl">
<Media src="/assets/home/dest-ibiza-b-1024.webp" alt="Casa en Ibiza" aspect="4/3" />
<div class="absolute top-4 left-4 flex gap-2">
<Badge tone="glass">Última fracción</Badge>
<Badge tone="accent">1/8</Badge>
</div>
</div> Tag y chip
shape="tag" es el «Tag» de Components_Web (242:336): esquinas rectas, 12/18 medium, el estado sobre una foto (la tarjeta de casa lo usa). shape="chip" es el «Chip» «Potenciador» (231:61): un icono de marca y una línea de 16/22, sin fondo.
---
import Badge from '@vivla-cms/ds/primitives/Badge.astro'
import Icon from '@vivla-cms/ds/primitives/Icon.astro'
---
<Badge shape="tag">En construcción</Badge>
<Badge shape="tag" tone="accent">Última fracción</Badge>
<Badge shape="chip"><Icon name="key" size={24} />Desde 120.000 € por fracción</Badge> Tag suave, tag pequeño y anillo de paso
tone="soft" es el relleno del Tag en Figma: terracota-60 con texto espresso en todos los temas (también en el menú negro). size="tag-sm" es el tag compacto del menú («Contratando», «Webinar»): padding 4 / 16, 26 de alto; sin él, el tag mide 42 (12 / 16). shape="circle" size="ring" es el anillo de 46 de los pasos de /how-it-works, con la cifra en PP Right Serif 24.
---
import Badge from '@vivla-cms/ds/primitives/Badge.astro'
---
<Badge shape="tag" tone="soft">Primera línea</Badge>
<Badge shape="tag" size="tag-sm" tone="soft">Contratando</Badge>
<Badge shape="tag" size="tag-sm" tone="soft">Webinar</Badge>
<Badge shape="circle" tone="outline" size="ring" font="display" aria-hidden="true">1</Badge>
<Badge shape="circle" tone="outline" size="ring" font="display" aria-hidden="true">2</Badge> Props
| Prop | Valores | Por defecto | Para qué |
|---|---|---|---|
| as | keyof HTMLElementTagNameMap | — | — |
| tone | accentneutraloutlineinverseglasssoftmist | 'neutral' | — |
| size | smmdtag-smring | 'sm' | pill: sm / md text chip · tag: default 42 px, tag-sm = 26 px (padding
4 / 16) · circle, square: sm = 40 → 44 px, md = 44 → 56 px icon disc,
ring = 46 px step ring |
| shape | pillcirclesquaretagchip | 'pill' | pill = uppercase text chip (default) · tag = Components_Web Tag · chip = Components_Web Chip · circle / square = fixed box for one icon or numeral |
| font | bodydisplay | 'body' | body (default) · display = serif numeral (step ring) |
| [string] | unknown | — | Se pasan tal cual al elemento. |
Slots: contenido
Notas del código
El comentario de cabecera de Badge.astro, tal cual (en inglés, como el código): si cambia el código, cambia esto.
small status / category tag ("1/8 disponible", "Nuevo") or a fixed round/square marker holding one icon or one numeral.
Usage:
<Badge tone="accent">Última fracción</Badge>
<Badge shape="circle" tone="inverse" size="md" aria-hidden="true">
<Icon name="arrow-up-right" size={36} />
</Badge>
<Badge shape="circle" tone="outline" size="ring" font="display" aria-hidden="true">1</Badge> shape="pill" (default) is the uppercase text chip. circle / square are a fixed box with the content centred: sm = 40 → 44 px, md = 44 → 56 px (the arrow disc on destination panels 383:1751 and listing tiles 2003:3677), switching at md; ring = 46 px at every width with the numeral at typography-01-L (24/28, text-card) — the how-it-works step ring of the 30/10 hand-off (1263:3547 / 1347:2507, 1 px on-surface). In those shapes outline draws the ring in the on-surface role, as Figma does; the pill keeps the line hairline.
Size the icon by the glyph it draws, not by its box: arrow-up-right spans 10/24 of the Icon box, so size={36} draws a 15 px arrow, close to Figma's ~16 px in the 56 px disc (size={16} draws under 7 px). The stroke scales with it (1.5/24: 2.25 px at 36, Figma ~1.5 px); size={32} (13 px arrow, 2 px stroke) is the thinner option.
font="display" sets the numeral in PP Right Serif (text-lead in sm/md, text-card in ring). Icon-only or numeral markers are decorative next to a labelled heading or link: pass aria-hidden="true", or give the <Icon> a label when the badge stands alone. tone="glass" is the translucent chip Figma draws on terracotta (the «ÚLTIMA FRACCIÓN» badge, Test Jorge 877:2909): the theme's light text on a 15 % veil of itself. Design chose it over AA on 28/09 (≈ 3.5:1 on terracotta-500). accent is white on terracotta (4.77:1); on an accent band it flips to terracotta on white. neutral is the card step (surface-alt, white on the light ground). Ink on an accent or invest band is white in every tone (Foundations DARK content). soft is Figma's Tag fill: brand terracota-60 (#da957a, terracotta-200) with espresso text in EVERY theme (Tag 1347:2659 «Contratando», «Webinar»; the split house card, listings 1237:4156). The main menu whitens the text where its «Negro» desktop frames do, through class (menuTagInk in apps/web lib/menu.ts). mist is the Tag Figma lays over a photo or a video: grey/soft (#eeeeee, surface/04 → k-5) at 70 % with espresso text, the same in every theme (the destination tags over the home video, 00_Home 1922:13199 / phone 1922:13201, 06/11; espresso on the veil over pure black is still 7.6:1).
Figma Components_Web · Content (74zqbI8QliQL1oyXyFbsBT):
shape="tag" = «Tag» 464:628 (artboard 242:336): status over a photo, not
clickable. Square corners, padding 12 / 16 (42 tall),
typography-02-XS (12/18 medium, no uppercase), optional
20 px icon 4 px before the label; the colour is set per
instance (`tone`). `size="tag-sm"` is the compact instance
of the main menu (hand-off 1487:2127, Tag 1347:2659):
padding 4 / 16, 26 tall.
shape="chip" = «Chip» 231:56 (artboard «Potenciador» 231:61): a brand icon
(24 px) and a short phrase, transparent, full pill, padding
4 / 16, gap 10, typography-02-M (16/22 medium). `tone` is
ignored: it sits on the section surface.
The uppercase `pill` predates Components_Web; new status labels use `tag`.
<Badge shape="tag" tone="accent"><Icon name="shower" size={20} />Primera línea</Badge>
<Badge shape="tag" size="tag-sm" tone="soft">Contratando</Badge>
<Badge shape="tag" tone="mist" class="uppercase">México</Badge>
<Badge shape="chip"><Icon name="key" size={24} />Desde 120.000 € por fracción</Badge> Dónde se usa
31 veces en 10 archivos de la web y los bloques del CMS.
Ver los archivos
- apps/web/src/pages/dev/kit/type.astro ×9
- apps/web/src/pages/dev/kit/handoff.astro ×6
- apps/web/src/pages/dev/kit.astro ×5
- packages/cms-blocks/src/renderers/parts/HomeCard.astro ×4
- apps/web/src/layouts/chrome/menu/MenuBottombar.astro ×2
- apps/web/src/layouts/chrome/menu/MenuColumns.astro ×1
- apps/web/src/sections/destinations/DestinationPanels.astro ×1
- apps/web/src/sections/listing/ListingHero.astro ×1
- packages/cms-blocks/src/renderers/Statement/media.astro ×1
- packages/cms-blocks/src/renderers/StepPanel/parts/StepHeader.astro ×1