Saltar al contenido
DS

Componentes · Contenido

Icono <Icon>

Los iconos de línea de VIVLA en una rejilla de 24, con grosor constante a cualquier tamaño.

import Icon from '@vivla-cms/ds/primitives/Icon.astro'

Ejemplos

Tamaño y grosor

El trazo se mide en píxeles de pantalla y sube por escalones con el tamaño, como dibuja Foundations «Escala y grosor»: 1 px por debajo de 24 (los 20 px de botones, chevrons y menú) · 1,5 desde 24 · 2 desde 40 · 2,5 desde 64 · 3 desde 80 · 3,5 desde 120. No hace falta pasar weight: el escalón sale solo de size.

16 px trazo 1
20 px trazo 1
24 px trazo 1,5
32 px trazo 1,5
40 px trazo 2
64 px trazo 2,5
80 px trazo 3
120 px trazo 3,5

Línea e ilustrativo

variant="illustrative" es el dibujo con más detalle (remates redondos), solo desde 80 px y solo si el icono lo tiene: por debajo, o si no existe, se pinta el de línea. Arriba la línea, abajo el ilustrativo, ambos a 80 px.

A 40 px el ilustrativo cae a línea:

Color

El trazo es currentColor: el icono toma el color del texto. Cámbialo con un rol (text-accent, text-on-surface-muted), nunca con un código de color.

Decorativo o con nombre

Por defecto el icono es decorativo (aria-hidden), porque casi siempre va junto a un texto que ya lo dice. Si va solo y significa algo, dale label: pasa a ser una imagen con ese nombre.

4 dormitorios

Nombres y alias de vivla-tools

name acepta el nombre del icono o cualquier alias del set, incluidos los slugs de amenities de vivla-tools (private_pool, sea_views): una tarjeta de amenity pasa su iconSlug tal cual. Un nombre desconocido no pinta nada, nunca un dibujo equivocado (la última celda).

pool
private_pool
sea-view
sea_views
no-existe

Tamaño desde CSS

Con size={null} el icono lo dimensiona una clase (h-12 w-auto, size-[1em]): útil para que siga al tamaño del texto. El trazo queda entonces en el escalón más fino de la familia; pásale weight si lo quieres más grueso.

Ibiza

Props

Props de Icon
Prop Valores Por defecto Para qué
name * IconName | (string & {}) | null | undefined — Icon name (oven, arrow-right…) or alias / vivla-tools slug (private_pool).
size number | null 20 Square size in px; null = sized by CSS. Default 20.
weight number — Stroke in px. Default: the Foundations step for the size and family.
variant IconVariant 'line' line (default) or illustrative (≥ 80 px; falls back to line).
label string — —

Notas del código

El comentario de cabecera de Icon.astro, tal cual (en inglés, como el código): si cambia el código, cambia esto.

one glyph of the VIVLA icon set (packages/design-system/icons/; source of truth: Figma Foundations · Iconography, k6g2ouYffkdxaGatajN4sz page 34:6). Line only, stroke = currentColor, 24 grid.

name takes an icon name or any alias the set knows — vivla-tools amenity slugs included (private_pool, sea_views) — so an amenity card can pass its iconSlug straight through. An unknown key renders nothing: never a picture of something else. That covers an icon removed from the set (only Foundations drawings stay, J15) but still stored in the CMS: no svg and no error (a wrapper that sets its own size, like the /listings row's 80 px box, keeps it).

Two families:

  • variant="line" (default) — butt caps, round joins. The stroke is set in
screen px (`vector-effect: non-scaling-stroke`) and steps up with the
size, as Foundations «Escala y grosor» draws it: 1 px under 24 px (the
20 px default draws 1) · 1.5 from 24 · 2 from 40 · 2.5 from 64 · 3 from
80 · 3.5 from 120.
  • variant="illustrative" — the more detailed drawing («Ilustrativos»),
round caps and joins, 2 px at 80 · 3 px from 120. Used only when the
icon has one and the size is at least 80 px; otherwise the line drawing.
`city`, `house-chimney`, `mountain` and `villa` have no line drawing
(Foundations draws them only as illustrative): as line, or under 80 px,
they render nothing.

Pass weight to override. Size it with size (px) or with CSS (class="h-18 w-auto", pass size={null}: the stroke is then the family's smallest step — 1 px line, 2 px illustrative; a CSS-sized icon that grows past a step sets it with a stroke-* utility, e.g. lg:stroke-3).

Decorative by default (aria-hidden); pass label for a meaningful icon. Add a glyph with the vivla-design skill (references/icons-illustrations.md) — never inline path data here.

Dónde se usa

91 veces en 39 archivos de la web y los bloques del CMS.

Ver los archivos
esc