Primitives

Logo

The site logo, rendered as text, an image, or a vector.

The Logo primitive wraps a link/button around either a vector or an image and an optional label.

Default (label)

default
---
import Logo from '@alfadormx/blocks/primitives/Logo.astro';
---

<div class="flex items-center gap-4">
  <Logo />
</div>

Vector (SVG)

vector
---
import Logo from '@alfadormx/blocks/primitives/Logo.astro';
---

<div class="flex items-center gap-4">
  <Logo
    vector={{
      src: 'https://www.svgrepo.com/show/513167/basketball.svg',
      ariaLabel: 'Basketball',
      class: 'w-6 h-6',
    }}
    href="/"
  />
</div>

Image (raster)

Used when vector.src is not set. Supply width and height (or an aspectRatio) so the image optimizer can generate the rendered sources. alt falls back to the site name.

Logo
image
---
import Logo from '@alfadormx/blocks/primitives/Logo.astro';
---

<div class="flex items-center gap-4">
  <Logo
    image={{
      src: 'https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=200&h=200&fit=crop',
      alt: 'Logo',
      width: 48,
      height: 48,
    }}
    href="/"
  />
</div>

Label only (text)

label-only
---
import Logo from '@alfadormx/blocks/primitives/Logo.astro';
---

<div class="flex items-center gap-4">
  <Logo label="Simple Text Logo" labelClass="text-lg font-semibold" />
</div>

Custom classes

custom-classes
---
import Logo from '@alfadormx/blocks/primitives/Logo.astro';
---

<div class="flex items-center gap-4">
  <Logo
    label="Styled"
    class="p-2 text-accent"
    vector={{
      src: 'https://www.svgrepo.com/show/513167/basketball.svg',
      ariaLabel: 'Basketball',
    }}
    labelClass="text-xl font-bold"
  />
</div>

Notes

vector takes precedence over image — when both have a src, only the vector renders. Setting either one suppresses the default site-name label.

Logo renders its vector or image into the Button slot, so neither is forwarded to the Button’s own icon / image media slot. Every other prop is passed through to the Button primitive, so variant, intent, size, href and class behave exactly as they do there.

API Reference

PropTypeDefaultDescription
vectorVectorProps—Props for rendering the logo as an SVG vector; when its `src` is set, it takes precedence over `image` inside the Button.
imageImageProps—Props for rendering the logo as a raster image inside the Button slot; used when `vector.src` is not provided. Replaces Button's own `image` media slot.