Componentes · Maquetación
Banda <Section>
Cada banda de una página: pinta su tema, pone el espacio vertical y centra el contenido.
import Section from '@vivla-cms/ds/primitives/Section.astro'Ejemplos
Los seis temas
theme pone data-theme en la banda y la pinta con surface: todo lo que hay dentro (texto, botones, líneas) resuelve sus roles contra ese tema. paper, soft e invest solo los usan los renderers; el CMS ofrece claro, oscuro y terracota.
theme="light" · Claro
Casas para disfrutar, no para mantener
theme="paper" · Papel
Seis semanas al año por cada octavo
theme="soft" · Gris suave
De uno a cuatro octavos de una casa
theme="dark" · Oscuro
Donde el verano dura más
theme="accent" · Terracota
Tu casa en Ibiza, desde 1/8
theme="invest" · Cobalto
Una inversión que también se vive
---
import Button from '@vivla-cms/ds/primitives/Button.astro'
import Eyebrow from '@vivla-cms/ds/primitives/Eyebrow.astro'
import Heading from '@vivla-cms/ds/primitives/Heading.astro'
import Section from '@vivla-cms/ds/primitives/Section.astro'
const themes = [
{ theme: 'light', name: 'Claro', title: 'Casas para disfrutar, no para mantener' },
{ theme: 'paper', name: 'Papel', title: 'Seis semanas al año por cada octavo' },
{ theme: 'soft', name: 'Gris suave', title: 'De uno a cuatro octavos de una casa' },
{ theme: 'dark', name: 'Oscuro', title: 'Donde el verano dura más' },
{ theme: 'accent', name: 'Terracota', title: 'Tu casa en Ibiza, desde 1/8' },
{ theme: 'invest', name: 'Cobalto', title: 'Una inversión que también se vive' },
] as const
---
{
themes.map(({ theme, name, title }) => (
<Section theme={theme} spacing="none" class="py-12">
<div class="flex flex-col gap-4">
<Eyebrow>theme="{theme}" · {name}</Eyebrow>
<Heading level={2} size="h3">{title}</Heading>
<div class="flex flex-wrap gap-3">
<Button>Descubre las casas</Button>
<Button variant="secondary">Cómo funciona</Button>
</div>
</div>
</Section>
))
} Espaciado vertical
Foundations no tiene valores intermedios: default = 108 px arriba y abajo (toda sección), bleed = 216 px para bandas con imagen a sangre («se dobla») y none cuando el bloque pone su propio espacio. La franja punteada marca el contenido; lo demás es el padding de la banda.
spacing="default" 108 px en escritorio, 64 px en móvil (fluido)
spacing="bleed" 216 px en escritorio, 128 px en móvil (fluido)
spacing="none" sin padding: lo pone el bloque
---
import Section from '@vivla-cms/ds/primitives/Section.astro'
import Text from '@vivla-cms/ds/primitives/Text.astro'
const spacings = [
{ spacing: 'default', theme: 'paper', note: '108 px en escritorio, 64 px en móvil (fluido)' },
{ spacing: 'bleed', theme: 'light', note: '216 px en escritorio, 128 px en móvil (fluido)' },
{ spacing: 'none', theme: 'paper', note: 'sin padding: lo pone el bloque' },
] as const
---
{
spacings.map(({ spacing, theme, note }) => (
<Section theme={theme} spacing={spacing}>
<div class="flex items-baseline justify-between gap-4 border border-dashed border-line px-4 py-3">
<code class="font-mono text-small">spacing="{spacing}"</code>
<Text size="small" tone="muted">{note}</Text>
</div>
</Section>
))
} Anchos
width envuelve el contenido en un Container: shell (por defecto, el ancho de página), wide, prose (lectura) o full, que entrega el slot sin contenedor para diseños a sangre.
width="shell" width="wide" width="prose" width="full" ---
import Section from '@vivla-cms/ds/primitives/Section.astro'
const widths = ['shell', 'wide', 'prose', 'full'] as const
---
<Section theme="paper" spacing="none" width="full" class="py-8">
<div class="flex flex-col gap-3">
{
widths.map((width) => (
<Section theme="paper" spacing="none" width={width}>
<div class="bg-surface-alt px-4 py-3">
<code class="font-mono text-small">width="{width}"</code>
</div>
</Section>
))
}
</div>
</Section> Banda a sangre con foto
width="full" y spacing="none": el bloque pone la foto de borde a borde y su propio contenedor encima. Es el patrón de los heroes y de los capítulos con foto.
Ibiza, fuera de temporada
---
import Container from '@vivla-cms/ds/primitives/Container.astro'
import Heading from '@vivla-cms/ds/primitives/Heading.astro'
import Media from '@vivla-cms/ds/primitives/Media.astro'
import Section from '@vivla-cms/ds/primitives/Section.astro'
---
<Section theme="dark" width="full" spacing="none" class="relative">
<Media src="/assets/home/hero-1024.avif" alt="" aspect="21/9" class="w-full" />
<div class="absolute inset-0 flex items-end pb-10">
<Container>
<Heading level={2} size="h1" class="text-k-0">Ibiza, fuera de temporada</Heading>
</Container>
</div>
</Section> Heredar el tema de fuera
Una Section pone data-theme="light" si no se le dice otra cosa, aunque esté dentro de una banda oscura. Con theme="inherit" no pone ninguno: toma el tema del ancestro más cercano que lo tenga y sigue pintando su superficie y su espaciado. Útil para una banda anidada en otra (o dentro de un diálogo).
Sin theme · vuelve a claro
Seis semanas al año por cada octavo
theme="inherit" · el de fuera
Seis semanas al año por cada octavo
---
import Button from '@vivla-cms/ds/primitives/Button.astro'
import Eyebrow from '@vivla-cms/ds/primitives/Eyebrow.astro'
import Heading from '@vivla-cms/ds/primitives/Heading.astro'
import Section from '@vivla-cms/ds/primitives/Section.astro'
---
<div class="grid gap-px md:grid-cols-2">
<Section spacing="none" class="py-10">
<div class="flex flex-col gap-4">
<Eyebrow>Sin theme · vuelve a claro</Eyebrow>
<Heading level={3} size="h3">Seis semanas al año por cada octavo</Heading>
<div><Button>Descubre</Button></div>
</div>
</Section>
<Section theme="inherit" spacing="none" class="py-10">
<div class="flex flex-col gap-4">
<Eyebrow>theme="inherit" · el de fuera</Eyebrow>
<Heading level={3} size="h3">Seis semanas al año por cada octavo</Heading>
<div><Button>Descubre</Button></div>
</div>
</Section>
</div> Props
| Prop | Valores | Por defecto | Para qué |
|---|---|---|---|
| theme | | 'light' | 'dark' | 'accent' | 'accent-inverse' | 'invest' | 'paper' | 'soft' | 'inherit' | 'light' | Palette of the band (default light); inherit = the nearest themed ancestor's. |
| spacing | defaultbleednone | 'default' | — |
| width | shellwideprosefull | 'shell' | — |
| id | string | — | — |
| as | keyof HTMLElementTagNameMap | — | — |
| hidden | boolean | false | Hide the whole band. Prefer THIS over class="hidden": a <section> has
no competing display utility so the class happens to work today, but a
variant that adds flex/grid would silently beat .hidden (Tailwind
emits .hidden first and both are one class of specificity — the bug that
kept /listings' «Aplicar» and «Ver más» buttons on screen). The hidden
ATTRIBUTE always wins via preflight. From a client script set the property. |
| data-* | string | undefined | — | Se pasan tal cual al elemento. |
| aria-* | string | undefined | — | Se pasan tal cual al elemento. |
Slots: contenido
Notas del código
El comentario de cabecera de Section.astro, tal cual (en inglés, como el código): si cambia el código, cambia esto.
the ONLY place section padding and theme live.
<Section theme="dark" width="prose" id="faq">…</Section> spacing (Foundations Layout «Padding vertical» L 768:292 / S 768:322): default = 104 px top and bottom on desktop («toda sección»); bleed = 208 for image-bleed bands («se dobla»); none = the block owns its padding. On phones both are 80: that is what the hand-off frames draw (30/10, FI-19), where Layout S says 64 / 128 — one knob, section-phone in tokens.figma.json, so Jaime's answer is a one-line change. Two fixed steps, no fluid value in between («No hay valores intermedios»): the switch is at lg (62rem, stepAt in tokens.figma.json) because Figma draws no tablet — that breakpoint is revisable. (The 108 / 216 of Figma's «Ej. Full» 768:265 is corrected by Layout itself to 104 / 208.) The CMS «Compacto» option was retired on 15/10.
theme sets data-theme so every role utility inside (bg-surface, text-on-surface, text-accent…) resolves against that palette; the section paints itself with the surface roles. It defaults to light — a page band is light unless it says otherwise, even on a pageTheme="dark" page. inherit sets no data-theme: the section takes the theme of the nearest ancestor that has one (a band nested in a dark or terracotta band, a dialog body), still painting its surface. width wraps the slot in a <Container>; full hands the raw slot over for full-bleed layouts.
House rule: text inside a section is LEFT-aligned. The centred exceptions own their alignment in the block renderer: the image and text-over-media heroes and the statement-style bands (statement, the media collage title, the home showcase view-all bar).
Dónde se usa
176 veces en 110 archivos de la web y los bloques del CMS.
Ver los archivos
- apps/web/src/pages/dev/kit.astro ×14
- apps/web/src/pages/dev/kit/type.astro ×10
- apps/web/src/pages/dev/kit/media.astro ×9
- apps/web/src/pages/dev/kit/lead.astro ×6
- apps/web/src/pages/dev/kit/forms.astro ×5
- apps/web/src/layouts/chrome/Footer.astro ×3
- apps/web/src/pages/dev/homes.astro ×3
- apps/web/src/pages/dev/kit/icons.astro ×3
- apps/web/src/pages/dev/kit/video-parts.astro ×3
- apps/web/src/sections/blog/PostBody.astro ×3
- packages/cms-blocks/src/renderers/CtaBanner.astro ×3
- packages/cms-blocks/src/renderers/EditorialFeatures/index.astro ×3
- packages/cms-blocks/src/renderers/EditorialText.astro ×3
- apps/web/src/pages/careers.astro ×2
- apps/web/src/pages/careers/[slug].astro ×2
- apps/web/src/pages/dev/kit/forms-real.astro ×2
- apps/web/src/pages/dev/kit/handoff.astro ×2
- apps/web/src/sections/destinations/DestinationPanels.astro ×2
- packages/cms-blocks/src/renderers/Accordion/split.astro ×2
- packages/cms-blocks/src/renderers/Accordion/stacked.astro ×2
- packages/cms-blocks/src/renderers/HomeShowcase.astro ×2
- packages/cms-blocks/src/renderers/HtmlEmbed.astro ×2
- packages/cms-blocks/src/renderers/Prose.astro ×2
- packages/cms-blocks/src/renderers/SplitFeature.astro ×2
- apps/web/src/components/NotFoundPage.astro ×1
- apps/web/src/layouts/chrome/ContactFormBand.astro ×1
- apps/web/src/pages/dev/blocks/index.astro ×1
- apps/web/src/pages/dev/chrome.astro ×1
- apps/web/src/pages/dev/hero/index.astro ×1
- apps/web/src/pages/dev/listing-nearby.astro ×1
- apps/web/src/pages/dev/listing-upcoming.astro ×1
- apps/web/src/pages/faqs.astro ×1
- apps/web/src/pages/index.astro ×1
- apps/web/src/pages/owner-stories.astro ×1
- apps/web/src/sections/blog/BlogFilters.astro ×1
- apps/web/src/sections/blog/Newsletter.astro ×1
- apps/web/src/sections/blog/PostGrid.astro ×1
- apps/web/src/sections/blog/PostHeader.astro ×1
- apps/web/src/sections/blog/PostShare.astro ×1
- apps/web/src/sections/blog/RelatedPosts.astro ×1
- apps/web/src/sections/careers/OpenApplication.astro ×1
- apps/web/src/sections/destinations/DestinationEconomics.astro ×1
- apps/web/src/sections/destinations/DestinationHomes.astro ×1
- apps/web/src/sections/faqs/FaqHelp.astro ×1
- apps/web/src/sections/faqs/FaqHub.astro ×1
- apps/web/src/sections/faqs/FaqsHero.astro ×1
- apps/web/src/sections/listing/ListingDesign.astro ×1
- apps/web/src/sections/listing/ListingEconomics.astro ×1
- apps/web/src/sections/listing/ListingFinishes.astro ×1
- apps/web/src/sections/listing/ListingGallery.astro ×1
- apps/web/src/sections/listing/ListingHighlights.astro ×1
- apps/web/src/sections/listing/ListingIntro.astro ×1
- apps/web/src/sections/listing/ListingNearby.astro ×1
- apps/web/src/sections/listing/ListingShare.astro ×1
- apps/web/src/sections/listing/ListingStats.astro ×1
- apps/web/src/sections/listing/SimilarHomes.astro ×1
- apps/web/src/sections/listing/UpcomingPriority.astro ×1
- apps/web/src/sections/listings/ListingsFeatured.astro ×1
- apps/web/src/sections/listings/ListingsGrid.astro ×1
- apps/web/src/sections/listings/ListingsHeader.astro ×1
- apps/web/src/sections/listings/ListingsResultsBar.astro ×1
- apps/web/src/sections/press/PressHero.astro ×1
- apps/web/src/sections/press/PressList.astro ×1
- packages/cms-blocks/src/renderers/CardGrid/grid.astro ×1
- packages/cms-blocks/src/renderers/CardGrid/offset.astro ×1
- packages/cms-blocks/src/renderers/CardGrid/overlay.astro ×1
- packages/cms-blocks/src/renderers/CardGrid/team.astro ×1
- packages/cms-blocks/src/renderers/Chapter/figure.astro ×1
- packages/cms-blocks/src/renderers/Chapter/inset.astro ×1
- packages/cms-blocks/src/renderers/Chapter/split.astro ×1
- packages/cms-blocks/src/renderers/Chapter/story.astro ×1
- packages/cms-blocks/src/renderers/ComparisonTable.astro ×1
- packages/cms-blocks/src/renderers/ContactPanel.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/FeatureList/reveal.astro ×1
- packages/cms-blocks/src/renderers/Gallery.astro ×1
- packages/cms-blocks/src/renderers/Hero/halfPage.astro ×1
- packages/cms-blocks/src/renderers/Hero/image.astro ×1
- packages/cms-blocks/src/renderers/Hero/parts/FullBleedFrame.astro ×1
- packages/cms-blocks/src/renderers/Hero/text.astro ×1
- packages/cms-blocks/src/renderers/HomeShowcase/Grid.astro ×1
- packages/cms-blocks/src/renderers/LandingFaq.astro ×1
- packages/cms-blocks/src/renderers/LandingFeatures.astro ×1
- packages/cms-blocks/src/renderers/LandingPress.astro ×1
- packages/cms-blocks/src/renderers/LandingQuote.astro ×1
- packages/cms-blocks/src/renderers/LogoCloud.astro ×1
- packages/cms-blocks/src/renderers/Media.astro ×1
- packages/cms-blocks/src/renderers/MediaCollage/catalog.astro ×1
- packages/cms-blocks/src/renderers/MediaCollage/drift.astro ×1
- packages/cms-blocks/src/renderers/MediaCollage/mosaic.astro ×1
- packages/cms-blocks/src/renderers/MediaCollage/orbital.astro ×1
- packages/cms-blocks/src/renderers/NumberedList/columns.astro ×1
- packages/cms-blocks/src/renderers/NumberedList/rows.astro ×1
- packages/cms-blocks/src/renderers/NumberedList/timeline.astro ×1
- packages/cms-blocks/src/renderers/parts/CardRail.astro ×1
- packages/cms-blocks/src/renderers/SplitBanner.astro ×1
- packages/cms-blocks/src/renderers/Statement/columns.astro ×1
- packages/cms-blocks/src/renderers/Statement/cta.astro ×1
- packages/cms-blocks/src/renderers/Statement/media.astro ×1
- packages/cms-blocks/src/renderers/Statement/portrait.astro ×1
- packages/cms-blocks/src/renderers/Statement/text.astro ×1
- packages/cms-blocks/src/renderers/StatsBand.astro ×1
- packages/cms-blocks/src/renderers/StepPanel/calendar.astro ×1
- packages/cms-blocks/src/renderers/StepPanel/collage.astro ×1
- packages/cms-blocks/src/renderers/StepPanel/duo.astro ×1
- packages/cms-blocks/src/renderers/StepPanel/single.astro ×1
- packages/cms-blocks/src/renderers/StepPanel/trio.astro ×1
- packages/cms-blocks/src/renderers/StepPanel/wide.astro ×1
- packages/cms-blocks/src/renderers/Testimonials/scattered.astro ×1