📲
HC Mobile App UI Docs
  • Introduction
  • Foundations
    • Colors
    • Icons
    • Layout Primitives
    • Theming
  • Typography
    • Heading
    • Text
    • Custom Fonts
  • Components
    • Accordion
    • Avatar
    • Bottom Sheet
    • Button
    • Button Group
    • Card List
    • Card List Item
    • Checkbox
    • Chip
    • Date Picker
    • Divider
    • Expandable Card
    • Floater
    • Horizontal List
    • Icon
    • Icon Toggle
    • Link
    • List Header
    • Lower Prompt
    • Nestable List
    • Pill Toggle
    • Radio
    • Select Picker
    • Selectable List
    • Text Input
    • Tiles
  • Utilities
    • Device Utilities
    • Layout Utilities
  • Resources
    • Issues
    • Changelog
    • GitHub
Powered by GitBook
On this page
  1. Typography

Custom Fonts

PreviousTextNextAccordion

Last updated 3 years ago

CtrlK

Since every app will have its own set of typographic language such as different and multiple variations of fonts and sizes, MAU allows fonts families to be specified in the theme.

By default, MAU has two sets of fonts: primary and secondary. Each set has four variations, light, regular, semi-bold and bold. See Theming. Most of the components will always use the primary and secondary font sets for typography.

However, in case you need more fonts, you can easily extend the theme like:

import { defaultTheme } from 'hc-mobile-app-ui';

const customTheme = {
    ...defaultTheme,
    typography: {
        ...defaultTheme.typography,
        faces: {
            ......defaultTheme.typography.faces,
            
            // Custom Family One
            customFamilyOneLight: 'Nunito-Light',
            customFamilyOneRegular: 'Nunito-Regular',
            customFamilyOneSemiBold: 'Nunito-SemiBold',
            customFamilyOneBold: 'Nunito-Bold',
            
            // Custom Family Two
            customFamilyTwoLight: 'Manrope-Light',
            customFamilyTwoRegular: 'Manrope-Regular',
            customFamilyTwoSemiBold: 'Manrope-SemiBold',
            customFamilyTwoBold: 'Manrope-Bold',
        }
    }
}

These families can later be used in the Typographic components like:

import { Text, Heading } from 'hc-mobile-app-ui';

const App = () => {
    return (
        ...
        <Text font="customFamilyOne" weight="light">
            ...
        </Text>
        
        <Heading font="customFamilyTwo">
            ...
        </Heading>
        ...
    )
}