Saltar al contenido
DS

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

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

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"

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

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

Props

Props de Section
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
esc