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.
---
import Icon from '@vivla-cms/ds/primitives/Icon.astro'
const steps = [
{ size: 16, weight: '1' },
{ size: 20, weight: '1' },
{ size: 24, weight: '1,5' },
{ size: 32, weight: '1,5' },
{ size: 40, weight: '2' },
{ size: 64, weight: '2,5' },
{ size: 80, weight: '3' },
{ size: 120, weight: '3,5' },
]
---
<div class="flex flex-wrap items-end gap-8">
{
steps.map(({ size, weight }) => (
<figure class="flex flex-col items-center gap-3">
<Icon name="house" size={size} />
<figcaption class="text-center text-small text-on-surface-muted">
{size} px
<span class="block text-[0.75rem] text-on-surface-subtle">trazo {weight}</span>
</figcaption>
</figure>
))
}
</div> 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:
---
import Icon from '@vivla-cms/ds/primitives/Icon.astro'
const names = ['sauna', 'jacuzzi', 'bbq', 'fireplace', 'sea-view', 'ski']
---
<div class="flex flex-wrap gap-8">
{names.map((name) => <Icon name={name} size={80} />)}
</div>
<div class="flex flex-wrap gap-8">
{names.map((name) => <Icon name={name} size={80} variant="illustrative" />)}
</div>
<p class="text-small text-on-surface-muted">A 40 px el ilustrativo cae a línea: <Icon name="sauna" size={40} variant="illustrative" class="inline align-middle" /></p> 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.
---
import Icon from '@vivla-cms/ds/primitives/Icon.astro'
---
<Icon name="pool" size={40} class="text-on-surface" />
<Icon name="pool" size={40} class="text-on-surface-muted" />
<Icon name="pool" size={40} class="text-on-surface-subtle" />
<Icon name="pool" size={40} class="text-accent" />
<span class="inline-flex size-16 items-center justify-center bg-accent text-on-accent"><Icon name="pool" size={40} /></span> 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
---
import Icon from '@vivla-cms/ds/primitives/Icon.astro'
import Text from '@vivla-cms/ds/primitives/Text.astro'
---
<Text class="flex items-center gap-2"><Icon name="bed" size={24} /> 4 dormitorios</Text>
<div class="flex items-center gap-4">
<Icon name="wifi" size={32} label="Wifi" />
<Icon name="parking" size={32} label="Parking" />
<Icon name="pool" size={32} label="Piscina" />
</div> 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).
---
import Icon from '@vivla-cms/ds/primitives/Icon.astro'
const keys = ['pool', 'private_pool', 'sea-view', 'sea_views', 'no-existe']
---
{
keys.map((key) => (
<figure class="flex w-28 flex-col items-center gap-2 border border-line/40 p-4">
<span class="flex size-8 items-center justify-center"><Icon name={key} size={32} /></span>
<figcaption class="font-mono text-[0.75rem] text-on-surface-muted">{key}</figcaption>
</figure>
))
} 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.
---
import Icon from '@vivla-cms/ds/primitives/Icon.astro'
---
<span class="font-display text-h2">Ibiza <Icon name="arrow-up-right" size={null} class="inline size-[1em] align-baseline" /></span>
<Icon name="globe" size={null} class="h-12 w-auto" />
<Icon name="globe" size={null} weight={2.5} class="h-12 w-auto" /> Props
| 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
- apps/web/src/pages/dev/kit.astro ×10
- apps/web/src/pages/dev/kit/icons.astro ×8
- apps/web/src/layouts/chrome/Nav.astro ×6
- apps/web/src/pages/dev/kit/handoff.astro ×4
- apps/web/src/pages/dev/kit/type.astro ×4
- packages/cms-blocks/src/renderers/parts/HomeCard.astro ×4
- packages/cms-blocks/src/renderers/parts/LeadForm.astro ×4
- apps/web/src/layouts/chrome/ContactDock.astro ×3
- apps/web/src/sections/listings/FilterSegment.astro ×3
- packages/cms-blocks/src/renderers/LandingHero.astro ×3
- packages/cms-blocks/src/renderers/parts/LeadFormControl.astro ×3
- apps/web/src/layouts/chrome/menu/MenuBottombar.astro ×2
- apps/web/src/layouts/chrome/menu/MenuFeature.astro ×2
- apps/web/src/layouts/chrome/menu/MenuTopbar.astro ×2
- apps/web/src/sections/blog/PostHeader.astro ×2
- apps/web/src/sections/faqs/FaqCategoryCard.astro ×2
- apps/web/src/sections/faqs/FaqCategoryPanel.astro ×2
- apps/web/src/sections/listing/ListingHighlights.astro ×2
- apps/web/src/sections/listing/ListingNearby.astro ×2
- packages/cms-blocks/src/renderers/ComparisonTable.astro ×2
- packages/cms-blocks/src/renderers/parts/VideoTrigger.astro ×2
- packages/cms-blocks/src/renderers/StepPanel/wide.astro ×2
- apps/web/src/layouts/chrome/LanguageSwitch.astro ×1
- apps/web/src/layouts/chrome/menu/MenuStories.astro ×1
- apps/web/src/sections/blog/PostShare.astro ×1
- apps/web/src/sections/destinations/DestinationPanels.astro ×1
- apps/web/src/sections/listing/ListingAmenityList.astro ×1
- apps/web/src/sections/listing/ListingEconomics.astro ×1
- apps/web/src/sections/listing/ListingFinishes.astro ×1
- apps/web/src/sections/listing/ListingSpecSheetLink.astro ×1
- apps/web/src/sections/listings/ListingsHeader.astro ×1
- apps/web/src/sections/press/PressRow.astro ×1
- packages/cms-blocks/src/renderers/FeatureList/list.astro ×1
- packages/cms-blocks/src/renderers/FeatureList/panel.astro ×1
- packages/cms-blocks/src/renderers/LandingFeatures.astro ×1
- packages/cms-blocks/src/renderers/LandingOwners.astro ×1
- packages/cms-blocks/src/renderers/parts/HomeRail.astro ×1
- packages/cms-blocks/src/renderers/parts/LandingForm.astro ×1
- packages/cms-blocks/src/renderers/parts/VideoTranscript.astro ×1