Web Design Components

The PyData Sphinx Theme uses sphinx-design to add several UI components and provide extra flexibility for content creation. These include badges, buttons, cards, and tabs, among other components. This theme provides custom CSS to ensure that sphinx-design elements look and feel consistent with this theme.

Seealso

For more information about how to use these extensions, see the sphinx-design documentation.

Below you can find some examples of the components created with the sphinx-design extension.

Badges and button-links#

Here are some of the available badges:

primary secondary success primary outline secondary outline success outline

Here are some of the available button-style links, also using semantic colors:

Info Success Warning Danger Muted Light Dark
Note

Sphinx Design buttons are actually links, meaning they are rendered in HTML with <a> tags instead of <button>. Use them if you need a link to look like a button, however, be aware that they do not follow accessibility best practices for native button components such as using the correct ARIA attributes.

Cards#

Tabs#

Code example from the PyData Sphinx Theme’s kitchen sink:

int main(const int argc, const char **argv) {
    return 0;
}
def main():
    return
class Main {
    public static void main(String[] args) {
    }
}
function main()
end
PROGRAM main
END PROGRAM main

An example with headings

How would this work?#

Hello world

Syntax Description
Header Title
Paragraph Text
def foo(x):
    return x + 1

What now?#

Well, this is a good question.

Another hello world

Dropdowns look similar to admonitions, but they are clickable interactive elements that can be used to hide content. See the Sphinx Design Dropdown documentation for more information.

::: admonition An admonition for reference.

And some admonition content. :::

 
And with no title and some content!
With a title
And some content!
With a title and icon
And some content and an icon!
A primary color dropdown
And some content and an icon!
A secondary color dropdown
And some content and an icon!

Copybuttons#

sphinx-copybutton adds a copy button to each of your code cells. You can see it in action by hovering over the code cell below:

print("A copybutton in the top-right!")

Toggle buttons#

sphinx-togglebutton allows you to convert admonitions into toggle-able elements.

::: {.admonition .dropdown} Click me to toggle!

This will be hidden until a click! :::

::: toggle A standalone toggle button! :::

On this page