--- name: "naive-ui-design-typography" description: "Typography design specifications for Naive UI. Invoke when user needs to understand font conventions, font-family settings, or text styling guidelines." metadata: author: jiaiyan version: "1.0.0" --- # Typography Design Specifications Naive UI creates font conventions to ensure the best presentation across different platforms. Typography is an art that enhances readability and visual hierarchy. ## When to Use - Understanding font conventions - Applying consistent text styles - Setting font-family for cross-platform compatibility - Managing font sizes and line heights - Using typography components --- ## Font Family Naive UI uses a carefully selected font stack for optimal cross-platform display. ### Sans-serif Font (Default) ```css font-family: v-sans, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; ``` ### Monospace Font ```css font-family: v-mono, SFMono-Regular, Menlo, Consolas, Courier, monospace; ``` ### Font Stack Explanation | Font | Platform | Purpose | |------|----------|---------| | v-sans | All | Custom sans-serif font (can be configured) | | system-ui | All | System UI font | | -apple-system | macOS/iOS | Apple system font | | BlinkMacSystemFont | macOS | Chrome on macOS | | Segoe UI | Windows | Windows system font | | Apple Color Emoji | macOS/iOS | Emoji support | | Segoe UI Emoji | Windows | Emoji support | --- ## Font Sizes Naive UI provides standardized font size variables for different contexts. | CSS Variable | Value | Usage | |--------------|-------|-------| | `--font-size` | `14px` | Base body text | | `--font-size-mini` | `12px` | Mini text, tiny labels | | `--font-size-tiny` | `12px` | Tiny text | | `--font-size-small` | `14px` | Small text | | `--font-size-medium` | `14px` | Medium text | | `--font-size-large` | `15px` | Large text | | `--font-size-huge` | `16px` | Huge text | ### Usage Examples ```vue ``` --- ## Font Weight | CSS Variable | Value | Usage | |--------------|-------|-------| | `--font-weight` | `400` | Normal text weight | | `--font-weight-strong` | `500` | Emphasized text | ```vue ``` --- ## Line Height | CSS Variable | Value | Usage | |--------------|-------|-------| | `--line-height` | `1.6` | Default line height for body text | --- ## Header Typography Naive UI provides typography components with predefined header styles. ### Header Font Sizes | Level | Font Size | Margin | |-------|-----------|--------| | H1 | `30px` | `28px 0 20px 0` | | H2 | `22px` | `28px 0 20px 0` | | H3 | `18px` | `28px 0 20px 0` | | H4 | `16px` | `28px 0 18px 0` | | H5 | `16px` | `28px 0 18px 0` | | H6 | `16px` | `28px 0 18px 0` | ### Header Components ```vue ``` ### Header with Prefix Bar Headers can display a colored bar prefix for visual emphasis. ```vue ``` --- ## Text Component Naive UI provides a Text component for styled text display. ### Text Types ```vue ``` ### Text Depth ```vue ``` ### Text with Tag ```vue ``` --- ## Paragraph Component ```vue ``` --- ## Other Typography Components ### Anchor (Link) ```vue ``` ### Horizontal Rule ```vue ``` ### Lists ```vue ``` ### Blockquote ```vue ``` --- ## CSS Variables Summary ```css :root { --font-family: v-sans, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; --font-family-mono: v-mono, SFMono-Regular, Menlo, Consolas, Courier, monospace; --font-size: 14px; --font-size-mini: 12px; --font-size-tiny: 12px; --font-size-small: 14px; --font-size-medium: 14px; --font-size-large: 15px; --font-size-huge: 16px; --font-weight: 400; --font-weight-strong: 500; --line-height: 1.6; } ``` --- ## Component Heights Naive UI uses standardized heights for form controls and interactive elements. | CSS Variable | Value | Usage | |--------------|-------|-------| | `--height-mini` | `16px` | Mini size controls | | `--height-tiny` | `22px` | Tiny size controls | | `--height-small` | `28px` | Small size controls | | `--height-medium` | `34px` | Medium size controls (default) | | `--height-large` | `40px` | Large size controls | | `--height-huge` | `46px` | Huge size controls | --- ## Best Practices 1. **Use Typography Components**: Use `n-h1` through `n-h6`, `n-p`, `n-text` for consistent styling 2. **Cross-Platform**: The font stack ensures consistent display across platforms 3. **Hierarchy**: Use font sizes and depths to establish visual hierarchy 4. **Line Height**: Maintain readable line height (1.6) for body text 5. **Dark Mode**: Typography automatically adjusts in dark mode 6. **Semantic HTML**: Use appropriate tags (`tag` prop) for accessibility --- ## Related Resources | Resource | Description | |----------|-------------| | [Typography Components](https://www.naiveui.com/en-US/os-theme/components/typography) | Full typography documentation | | [useThemeVars](https://www.naiveui.com/en-US/os-theme/docs/theme) | Access theme variables | | [Color Design](./naive-ui-design-color/SKILL.md) | Text color variables | | [Border Design](./naive-ui-design-border/SKILL.md) | Related design specifications |