Overview
Font customization lets you match your embedded agent’s typography to your product’s design system. Instead of using default fonts, you can use Google Fonts or host your own custom fonts—creating a seamless experience where agents feel like a native part of your product. You can customize:- Font family — Use any Google Font or self-hosted custom font
- Font weights and styles — Define multiple weights (regular, bold, etc.) and styles (normal, italic)
- Typography scale — Override font sizes, weights, letter spacing, and line heights for specific UI elements
Quick Start: Using Google Fonts
The simplest way to customize fonts is to use a Google Font. Just specify the font family name in your SDK initialization.Basic Example
Available Google Fonts
Browse the complete library of Google Fonts at fonts.google.com. Any font listed there can be used with thefontFamily parameter.
Using Custom Self-Hosted Fonts
For complete control over typography, you can use self-hosted fonts. This requires hosting the font files yourself and providing additional metadata.Requirements
Before implementing custom fonts, you’ll need:- Font files — Font files in
.ttfor.otfformat - Public hosting — A publicly accessible URL where your font files are hosted
- SHA-256 checksum — The checksum of each font file for integrity verification
- File size — The exact size of each font file in bytes
- Licensing — Ensure you have proper licensing for web embedding
Implementation
Font Details Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
fontWeight | Number | Yes | The weight of the font (e.g., 400 for regular, 600 for semi-bold, 700 for bold) |
sha256Checksum | String | Yes | SHA-256 checksum of the font file for integrity verification |
fontUrl | String | Yes | Publicly accessible URL where the font file is hosted |
fileSize | Number | Yes | Size of the font file in bytes |
fontStyle | String | Yes | Style of the font: 'normal' or 'italic' |
Generating Required Metadata
SHA-256 Checksum (Linux/Mac):Font Character Coverage
When using custom fonts, ensure they include all required characters:- Standard alphanumeric characters
- Special symbols and punctuation
- Multilingual character sets (if your agents support multiple languages)
Customizing Typography Scale
Whether you’re using Google Fonts or custom fonts, you can override specific typography styles used throughout the agent UI.Basic Override Example
titleSmall style—all other styles remain at their defaults.
You only need to specify the properties you want to override. Unspecified properties will use default values.
Typography Properties
Each text style can include these properties:| Property | Type | Description |
|---|---|---|
fontSize | Number | Font size in pixels |
fontWeight | Number | Font weight (100-900) |
letterSpacing | Number | Letter spacing in pixels |
height | Number | Line height as a multiplier (e.g., 1.5 = 150% of font size) |
Default Typography Scale
The agent UI uses typography tokens based on the Material 3 Design type scale. These tokens define consistent text styles across the interface.Default Values
Where Typography Tokens Are Used
The agent UI applies these typography tokens to specific interface elements:| Token Category | Available Tokens | Usage Examples |
|---|---|---|
| Title | titleLargetitleMediumtitleSmall | Dialog headers Section titles in carousels and prompts Metadata labels and source titles Zero state messages |
| Body | bodyMediumbodySmall | List items and thread titles Agent details and descriptions Buttons, pills, and labels Follow-up questions and citations Supporting UI text |
| Label | labelLargelabelMediumlabelSmall | Content list labels (sources, citations) Feedback form instructions Supplemental text in disclaimers Loading states and metadata |
Complete Customization Example
Here’s a comprehensive example showing Google Fonts with typography overrides:Hosting Custom Fonts
If you’re using self-hosted custom fonts, you’ll need to host them somewhere publicly accessible. Here are recommended hosting options:Recommended: Cloud Storage (Production)
Best for: Production applications with high traffic- Amazon S3
- Azure Blob Storage
- Google Cloud Storage
Upload fonts to an S3 bucket with public read access. Optionally use CloudFront CDN for better performance.Example URL:
Alternative: Static Hosting Services
Best for: Small to medium projects, prototyping- Netlify / Vercel — Deploy fonts as static assets in your project
- Cloudflare Pages — Host fonts with automatic global CDN
- DigitalOcean Spaces — S3-compatible storage with CDN
Development Only: GitHub
Best for: Testing and development (not production) Host font files in a public GitHub repository:Firebase Storage
Upload fonts to Firebase Storage and set them to publicly readable:- Upload font files to Firebase Storage
- Set read permissions to public
- Generate direct download link from Firebase Console
Not Recommended: Google Drive
Best Practices
Font Selection
Match your product’s design system. Use the same font family your product uses to create visual consistency. Provide multiple weights. Include at least regular (400) and bold (700) weights for proper text hierarchy. Test multilingual support. If your agents support multiple languages, verify your font includes all necessary character sets. Check licensing. Ensure you have proper licensing for web embedding before using custom fonts.Performance
Use Google Fonts when possible. They’re automatically optimized, cached, and require no hosting setup. Host custom fonts on a CDN. Use cloud storage with CDN for fast global delivery. Limit font weights. Only include the weights you actually use to reduce load times. Verify file sizes. Large font files (>1MB) can slow down initial load. Consider using subsets or optimized formats.Typography Scale
Start with defaults. Test the default typography scale before customizing. Override selectively. Only customize the tokens that need to match your design system. Maintain readability. Ensure font sizes, weights, and line heights provide comfortable reading experiences. Test across devices. Verify your typography works well on mobile, tablet, and desktop screens.Backward Compatibility
The SDK maintains backward compatibility for font configuration: No customization provided:- Uses default Poppins font family
- Applies default text styles
- Uses provided font family
- Applies default text styles
- Uses default Poppins font family
- Applies provided text styles
- Attempts to load as Google Font
- Falls back to Poppins if not found
Troubleshooting
Custom font not loading
Possible causes:- Font URL is not publicly accessible
- CORS headers not configured properly
- Incorrect SHA-256 checksum
- Incorrect file size
Font looks incorrect or fallback is used
Possible causes:- Missing font weights
- Font doesn’t include required characters
- Font style mismatch (normal vs italic)
fontDetails. Verify font includes all characters used in your agents. Check that fontStyle parameter matches actual font style.
Typography doesn’t match design system
Possible causes:- Using wrong typography tokens
- Not overriding enough properties
- Line height or letter spacing too different
Performance issues with custom fonts
Possible causes:- Font files are too large
- Hosting service is slow
- Too many font weights loaded