Getting started


Set up Material using Docker

The official Docker image for Material comes with all dependencies pre-installed and ready-to-use with the latest version published on PyPI, packaged in a very small image (28MB compressed).

Installing MkDocs

Before installing MkDocs, you need to make sure you have Python and pip – the Python package manager – up and running. You can verify if you're already good to go with the following commands:

python --version
# Python 2.7.13
pip --version
# pip 9.0.1

Installing and verifying MkDocs is as simple as:

pip install mkdocs && mkdocs --version
# mkdocs, version 0.16.0

MkDocs version requirements

Material requires MkDocs >= 0.16.

Furthermore, it is highly recommended to install Pygments and the PyMdown Extensions to get the most out of the Material theme:

pip install pygments
pip install pymdown-extensions

Installing Material

using pip

Material can be installed with pip:

pip install mkdocs-material

using choco

If you're on Windows you can use Chocolatey to install Material:

choco install mkdocs-material

This will also install all required dependencies like Python and MkDocs.

cloning from GitHub

Material can also be used without a system-wide installation by cloning the repository into a subfolder of your project's root directory:

git clone

This is especially useful if you want to extend the theme and override some parts of the theme. The theme will reside in the folder mkdocs-material/material.


Installation on macOS

When you're running the pre-installed version of Python on macOS, pip tries to install packages in a folder for which your user might not have the adequate permissions. There are two possible solutions for this:

  1. Installing in user space (recommended): Provide the --user flag to the install command and pip will install the package in a user-site location. This is the recommended way.

  2. Switching to a homebrewed Python: Upgrade your Python installation to a self-contained solution by installing Python with Homebrew. This should eliminate a lot of problems you may be having with pip.

Error: unrecognized theme 'material'

If you run into this error, the most common reason is that you installed MkDocs through some package manager (e.g. Homebrew or apt-get) and the Material theme through pip, so both packages end up in different locations. MkDocs only checks it's install location for themes.


In order to enable the Material theme just add one of the following lines to your mkdocs.yml. If you installed Material using pip:

theme: 'material'

If you cloned Material from GitHub:

theme_dir: 'mkdocs-material/material'

MkDocs includes a development server, so you can review your changes as you go. The development server can be started with the following command:

mkdocs serve

Now you can point your browser to localhost:8000 and the Material theme should be visible. From here on, you can start writing your documentation, or read on and customize the theme through some options.


The Material theme adds some extra variables for configuration via your project's mkdocs.yml. See the following sections for all available options.

Changing the color palette

Material defines a default hue for every primary and accent color on Google's Material Design color palette. This makes it very easy to change the overall look of the theme. Just set the primary and accent colors using the following variables in your mkdocs.yml:

    primary: 'indigo'
    accent: 'light blue'

Color names are case-insensitive, but must match the names of the Material Design color palette. Valid values are: red, pink, purple, deep purple, indigo, blue, light blue, cyan, teal, green, light green, lime, yellow, amber, orange, deep orange, brown, grey and blue grey. The last three colors can only be used as a primary color.

If the color is set via this configuration, an additional CSS file that defines the color palette is included. If you want to keep things lean, clone the repository and recompile the theme with your custom colors set. See the guide on customization for more information.

Primary colors

Click on a tile to change the primary color of the theme:

Accent colors

Click on a tile to change the accent color of the theme:

Changing the font family

Material uses the Roboto font family by default, specifically the regular sans-serif type for text and the monospaced type for code. Both fonts are loaded from Google Fonts and can easily be changed to other fonts, like for example the Ubuntu font family:

    text: 'Ubuntu'
    code: 'Ubuntu Mono'

The text font will be loaded in font-weights 400 and 700, the monospaced font in regular weight. If you want to load fonts from other destinations or don't want to use the Google Fonts loading magic, just set font to false:

  font: false

Adding a source repository

To include a link to the repository of your project within your documentation, set the following variables via your project's mkdocs.yml:

repo_name: 'my-github-handle/my-project'
repo_url: ''

Material will render the name of the repository next to the search bar on big screens and as part of the main navigation drawer on smaller screen sizes. Furthermore, if repo_url points to a GitHub, BitBucket or GitLab repository, the respective service logo will be shown next to the name of the repository. Additionally, for GitHub, the number of stars and forks is shown.

Why is there an edit button at the top of every article?

If the repo_url is set to a GitHub or BitBucket repository, and the repo_name is set to GitHub or BitBucket (implied by default), an edit button will appear at the top of every article. This is the automatic behavior that MkDocs implements. See the MkDocs documentation on more guidance regarding the edit_uri attribute, which defines whether the edit button is show or not.

Material makes it easy to add your logo. Your logo should have rectangular shape with a minimum resolution of 128x128, leave some room towards the edges and be composed of high contrast areas on a transparent ground, as it will be placed on the colored header bar and drawer. Simply create the folder docs/images, add your logo and embed it with:

  logo: 'images/logo.svg'

If you want to link your social accounts, the Material theme provides an easy way for doing this in the footer of the documentation using the automatically included FontAwesome webfont. The syntax is simple – the type must denote the name of the social service, e.g. github, twitter or linkedin and the link must contain the URL you want to link to:

    - type: 'github'
      link: ''
    - type: 'twitter'
      link: ''
    - type: 'linkedin'
      link: ''

The links are generated in order and the type of the links must match the name of the FontAwesome glyph. The fa is automatically added, so github will result in fa fa-github.

Google Analytics integration

MkDocs makes it easy to integrate site tracking with Google Analytics. Besides basic tracking, clicks on all outgoing links can be tracked as well as how site search is used. Tracking can be activated in your project's mkdocs.yml:

  - 'auto'

Disqus integation

Material for MkDocs is integrated with Disqus, so if you want to add a comments section to your documentation set the shortname of your Disqus project in your mkdocs.yml:

  disqus: 'your-disqus-shortname'

A new entry at the bottom of the table of contents is generated that is linking to the comments section. The necessary JavaScript is automatically included.


Material for MkDocs supports internationalization (i18n). In order to translate the labels (e.g. Previous and Next in the footer), you can override the file partials/language.html and provide your own translations inside the macro t:

{% macro t(key) %}{{ {
  "language": "en",
  "": "Edit this page",
  "footer.previous": "Previous",
  "": "Next",
  "meta.comments": "Comments",
  "meta.source": "Source",
  "search.placeholder": "Search",
  "search.result.placeholder": "Type to start searching",
  "search.result.none": "No matching documents",
  "": "1 matching document",
  "search.result.other": "# matching documents",
  "": "Go to repository",
  "toc.title": "Table of contents"
}[key] }}{% endmacro %}

Just copy the file from the original theme and make your adjustments. See the section on overriding partials and the general guide on theme extension in the customization guide.


From version 1.1.0 on, Material supports another layer on top of the main navigation for larger screens in the form of tabs. This is especially useful for larger documentation projects with a few top-level sections. Tabs can be enabled by setting the respective feature flag to true:

    tabs: true

More advanced customization

If you want to change the general appearance of the Material theme, see this article for more information on advanced customization.


MkDocs supports several Markdown extensions. The following extensions are not enabled by default (see the link for which are enabled by default) but highly recommended, so they should be switched on at all times:

  - admonition
  - codehilite(guess_lang=false)
  - toc(permalink=true)

For more information, see the following list of extensions supported by the Material theme including more information regarding installation and usage:

Full example

Below is a full example configuration for a mkdocs.yml:

# Project information
site_name: 'My Project'
site_description: 'A short description of my project'
site_author: 'John Doe'
site_url: ''

# Repository
repo_name: 'my-github-handle/my-project'
repo_url: ''

# Copyright
copyright: 'Copyright © 2016 - 2017 John Doe'

# Documentation and theme
theme: 'material'

# Options
  logo: 'images/logo.svg'
    primary: 'indigo'
    accent: 'indigo'
    text: 'Roboto'
    code: 'Roboto Mono'
    - type: 'github'
      link: ''
    - type: 'twitter'
      link: ''
    - type: 'linkedin'
      link: ''

# Google Analytics
  - 'auto'

# Extensions
  - admonition
  - codehilite(guess_lang=false)
  - toc(permalink=true)