Skip to content

Typography

Styles for headings, paragraphs, lists…etc

h1Large

h1

h2

h3

h4

p

Blockquote

Table

List

Lead

Large

Small

Muted

Custom font family

By default Shadcn UI uses Geist as default font family. To change it, add the local font to your project, for example in the /fonts directory. Then update your pubspec.yaml with something like this:

flutter:
fonts:
- family: UbuntuMono
fonts:
- asset: fonts/UbuntuMono-Regular.ttf
- asset: fonts/UbuntuMono-Italic.ttf
style: italic
- asset: fonts/UbuntuMono-Bold.ttf
weight: 700
- asset: fonts/UbuntuMono-BoldItalic.ttf
weight: 700
style: italic

Then in your ShadApp update the ShadTextTheme:

return ShadApp(
debugShowCheckedModeBanner: false,
themeMode: themeMode,
routes: routes,
theme: ShadThemeData(
brightness: Brightness.light,
colorScheme: const ShadZincColorScheme.light(),
textTheme: ShadTextTheme(
colorScheme: const ShadZincColorScheme.light(),
family: 'UbuntuMono',
),
),
...
);

Google font

Install the google_fonts package. Then add the google font to your ShadApp:

return ShadApp(
debugShowCheckedModeBanner: false,
themeMode: themeMode,
routes: routes,
theme: ShadThemeData(
brightness: Brightness.light,
colorScheme: const ShadZincColorScheme.light(),
textTheme: ShadTextTheme.fromGoogleFont(GoogleFonts.poppins),
),
...
);

Extend with custom styles

You can extend the ShadTextTheme with your own custom styles by using the custom parameter.

return ShadApp(
theme: ShadThemeData(
textTheme: ShadTextTheme(
custom: {
'myCustomStyle': const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w400,
color: Colors.blue,
),
},
),
),
);

Then you can access it like this ShadTheme.of(context).textTheme.custom['myCustomStyle']!.

Or you can create an extension on ShadTextTheme to make it easier to access:

extension CustomStyleExtension on ShadTextTheme {
TextStyle get myCustomStyle => custom['myCustomStyle']!;
}

In this way you can access it like other styles ShadTheme.of(context).textTheme.myCustomStyle.