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.
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.
Here are some of the available badges:
primary secondary success primary outline secondary outline success outlineHere are some of the available button-style links, also using semantic colors:
Info Success Warning Danger Muted Light Dark
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.
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
Hello world
Syntax | Description |
---|---|
Header | Title |
Paragraph | Text |
def foo(x):
return x + 1
Well, this is a good question.
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. :::
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!")
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! :::