Tipografía
Guías de tipografía para un estilo de texto consistente en todas las plataformas.
Familias de Fuentes
- Primaria: Host Grotesk (variable 300-800), con fallback a Roboto, Helvetica, Arial, sans-serif
- Títulos: Host Grotesk (variable 300-800), con fallback a Roboto, Helvetica, Arial, sans-serif
- Monoespaciada: Menlo, Monaco, 'Courier New', monospace
- Iconos: Material Symbols Rounded
Fuente Variable
Host Grotesk es una fuente variable que soporta pesos de 300 a 800, permitiendo transiciones suaves entre pesos sin necesidad de archivos separados.
Tamaños de Fuente
La tipografía está optimizada con base de 14px para Host Grotesk:
| Escala | Tamaño | Uso |
|---|---|---|
| xs | 12px | Texto extra pequeño (h6) |
| sm | 13px | Texto pequeño (h5) |
| base | 14px | Texto del cuerpo |
| h4 | 15px | Encabezado h4 |
| md | 17px | Texto medio (h3) |
| lg | 21px | Encabezado h2 |
| xl | 26px | Encabezado h1 |
| 2xl | 30px | Títulos grandes |
| 3xl | 36px | Títulos extra grandes |
| 4xl | 44px | Títulos hero |
Pesos de Fuente
Host Grotesk soporta pesos variables de 300 a 800:
- Light (300): Texto decorativo
- Normal (400): Texto del cuerpo
- Medium (500): Énfasis moderado (h5, h6)
- Semibold (600): Subtítulos (h3, h4)
- Bold (700): Títulos principales (h1, h2)
- Extrabold (800): Énfasis fuerte
Alturas de Línea
- Tight (1.0): Encabezados compactos
- Base (1.1): Texto general
- Relaxed (1.3): Contenido espaciado
- Loose (1.5): Contenido de lectura larga
Espaciado de Letras
- Tight: -0.025em - Encabezados grandes
- Normal: 0 - Texto general
- Wide: 0.025em - Texto pequeño
- Wider: 0.05em - Mayúsculas, énfasis
Uso
- CSS/HTML
- Angular
- Flutter
Variables CSS
:root {
/* Familias de fuentes */
--font-family-base: "Host Grotesk", Roboto, Helvetica, Arial, sans-serif;
--font-family-heading: "Host Grotesk", Roboto, Helvetica, Arial, sans-serif;
--font-family-mono: 'Menlo', 'Monaco', 'Courier New', monospace;
/* Tamaños de fuente */
--font-size-xs: 12px;
--font-size-sm: 13px;
--font-size-base: 14px;
--font-size-h4: 15px;
--font-size-md: 17px;
--font-size-lg: 21px;
--font-size-xl: 26px;
--font-size-2xl: 30px;
--font-size-3xl: 36px;
--font-size-4xl: 44px;
/* Pesos de fuente */
--font-weight-light: 300;
--font-weight-normal: 400;
--font-weight-medium: 500;
--font-weight-semibold: 600;
--font-weight-bold: 700;
--font-weight-extrabold: 800;
/* Alturas de línea */
--line-height-tight: 1;
--line-height-base: 1.1;
--line-height-relaxed: 1.3;
--line-height-loose: 1.5;
/* Espaciado de letras */
--letter-spacing-tight: -0.025em;
--letter-spacing-normal: 0;
--letter-spacing-wide: 0.025em;
--letter-spacing-wider: 0.05em;
}
Ejemplos de uso
/* Usar en componentes */
body {
font-family: var(--font-family-base);
font-size: var(--font-size-base);
font-weight: var(--font-weight-normal);
line-height: var(--line-height-base);
}
h1 {
font-family: var(--font-family-heading);
font-size: var(--font-size-xl);
font-weight: var(--font-weight-bold);
line-height: var(--line-height-tight);
}
.text-small {
font-size: var(--font-size-sm);
}
code {
font-family: var(--font-family-mono);
font-size: 0.875em;
}
Host Grotesk desde CDN
<!-- Ya incluido en WebFoundation, pero si necesitas usarlo standalone: -->
<link rel="preconnect" href="https://d320eox725dcq1.cloudfront.net">
<style>
@font-face {
font-family: 'Host Grotesk';
font-style: normal;
font-weight: 300 800;
font-display: swap;
src: url(https://d320eox725dcq1.cloudfront.net/assets/fonts/host-grotesk/co3BmWBnlCJ3U42vbbfdwMjZpFjm.woff2) format('woff2');
}
</style>
Variables CSS
:root {
/* Familias de fuentes */
--font-family-base: "Host Grotesk", Roboto, Helvetica, Arial, sans-serif;
--font-family-heading: "Host Grotesk", Roboto, Helvetica, Arial, sans-serif;
--font-family-mono: 'Menlo', 'Monaco', 'Courier New', monospace;
/* Tamaños de fuente */
--font-size-xs: 12px;
--font-size-sm: 13px;
--font-size-base: 14px;
--font-size-h4: 15px;
--font-size-md: 17px;
--font-size-lg: 21px;
--font-size-xl: 26px;
--font-size-2xl: 30px;
--font-size-3xl: 36px;
--font-size-4xl: 44px;
/* Pesos de fuente */
--font-weight-light: 300;
--font-weight-normal: 400;
--font-weight-medium: 500;
--font-weight-semibold: 600;
--font-weight-bold: 700;
--font-weight-extrabold: 800;
/* Alturas de línea */
--line-height-tight: 1;
--line-height-base: 1.1;
--line-height-relaxed: 1.3;
--line-height-loose: 1.5;
/* Espaciado de letras */
--letter-spacing-tight: -0.025em;
--letter-spacing-normal: 0;
--letter-spacing-wide: 0.025em;
--letter-spacing-wider: 0.05em;
}
Ejemplos de uso
// En estilos de componente
@Component({
selector: 'app-header',
styles: [`
h1 {
font-family: var(--font-family-heading);
font-size: var(--font-size-xl);
font-weight: var(--font-weight-bold);
line-height: var(--line-height-tight);
}
`]
})
export class HeaderComponent {}
// En archivos SCSS
.my-component {
font-family: var(--font-family-base);
font-size: var(--font-size-base);
h1 {
font-size: var(--font-size-xl);
font-weight: var(--font-weight-bold);
}
.subtitle {
font-size: var(--font-size-md);
font-weight: var(--font-weight-semibold);
}
code {
font-family: var(--font-family-mono);
font-size: var(--font-size-sm);
}
}
Host Grotesk en Angular
// /styles emite las reglas @font-face de Host Grotesk y Material Symbols
@use '@tiendana/web-foundation/styles';
Definir Tipografía
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
class TiendanaTypography {
// Font Families
static TextStyle get hostGrotesk => GoogleFonts.ibmPlexSans(); // Alternativa similar
// Font Sizes
static const double fontSizeXs = 12.0;
static const double fontSizeSm = 13.0;
static const double fontSizeBase = 14.0;
static const double fontSizeH4 = 15.0;
static const double fontSizeMd = 17.0;
static const double fontSizeLg = 21.0;
static const double fontSizeXl = 26.0;
static const double fontSize2xl = 30.0;
static const double fontSize3xl = 36.0;
static const double fontSize4xl = 44.0;
// Font Weights
static const FontWeight fontWeightLight = FontWeight.w300;
static const FontWeight fontWeightNormal = FontWeight.w400;
static const FontWeight fontWeightMedium = FontWeight.w500;
static const FontWeight fontWeightSemibold = FontWeight.w600;
static const FontWeight fontWeightBold = FontWeight.w700;
static const FontWeight fontWeightExtrabold = FontWeight.w800;
// Line Heights
static const double lineHeightTight = 1.0;
static const double lineHeightBase = 1.1;
static const double lineHeightRelaxed = 1.3;
static const double lineHeightLoose = 1.5;
// Text Styles
static TextStyle get h1 => hostGrotesk.copyWith(
fontSize: fontSizeXl,
fontWeight: fontWeightBold,
height: lineHeightTight,
);
static TextStyle get h2 => hostGrotesk.copyWith(
fontSize: fontSizeLg,
fontWeight: fontWeightBold,
height: lineHeightTight,
);
static TextStyle get body => hostGrotesk.copyWith(
fontSize: fontSizeBase,
fontWeight: fontWeightNormal,
height: lineHeightBase,
);
static TextStyle get code => const TextStyle(
fontFamily: 'monospace',
fontSize: fontSizeSm,
);
}
Ejemplos de uso
// Usar en widgets
Text(
'Título Principal',
style: TiendanaTypography.h1,
)
Text(
'Contenido del cuerpo',
style: TiendanaTypography.body,
)
// Personalizar
Text(
'Texto personalizado',
style: TiendanaTypography.hostGrotesk.copyWith(
fontSize: TiendanaTypography.fontSizeMd,
fontWeight: TiendanaTypography.fontWeightSemibold,
),
)
Host Grotesk en Flutter
Host Grotesk no está disponible en Google Fonts. Usa IBM Plex Sans o Inter como alternativas similares, o carga la fuente manualmente desde assets.
Jerarquía de Encabezados
| Elemento | Tamaño | Peso | Altura Línea | Uso |
|---|---|---|---|---|
| h1 | 26px | Bold (700) | Heredada | Título principal de página |
| h2 | 21px | Bold (700) | Heredada | Secciones principales |
| h3 | 17px | Semibold (600) | Heredada | Subsecciones |
| h4 | 15px | Semibold (600) | Base (1.1) | Grupos de contenido |
| h5 | 13px | Medium (500) | Base (1.1) | Etiquetas pequeñas |
| h6 | 12px | Medium (500) | Base (1.1) | Texto de ayuda |
Clases de Utilidad
WebFoundation incluye clases de utilidad para tipografía:
.h1a.h6- Aplicar estilos de encabezado sin semántica HTML.text-small- Texto pequeño (--font-size-sm).font-lighta.font-extrabold,.leading-tighta.leading-loosey.tracking-tighta.tracking-widerpara pesos, alturas de línea y espaciado de letras.ellipsis(una línea),.ellipsis--2a.ellipsis--5(varias líneas) y.truncate
El listado completo está en Utilidades CSS. Los encabezados h1 a h6 llevan un margen vertical de --spacing-sm, y h1 a h3 no fijan altura de línea: la heredan del contexto.
Accesibilidad
- Mantén un ratio de contraste mínimo de 4.5:1 para texto normal
- Ratio de contraste mínimo de 3:1 para texto grande (≥18px o ≥14px en bold)
- Usa tamaños de fuente escalables (rem/em) para soportar zoom del navegador
- Los encabezados deben seguir jerarquía lógica (h1 → h2 → h3)