holoviz / panel
1
"""
2
Bootstrap template based on the bootstrap.css library.
3
"""
4 7
import pathlib
5

6 7
import param
7

8 7
from ...layout import Card
9 7
from ..base import BasicTemplate
10 7
from ..theme import DarkTheme, DefaultTheme
11

12

13 7
class BootstrapTemplate(BasicTemplate):
14
    """
15
    BootstrapTemplate
16
    """
17 7
    sidebar_width = param.Integer(350, doc="""
18
        The width of the sidebar in pixels. Default is 350.""")
19

20 7
    _css = pathlib.Path(__file__).parent / 'bootstrap.css'
21

22 7
    _template = pathlib.Path(__file__).parent / 'bootstrap.html'
23

24 7
    _modifiers = {
25
        Card: {
26
            'children': {'margin': (10, 10)},
27
            'button_css_classes': ['card-button'],
28
            'margin': (10, 5)
29
        },
30
    }
31

32 7
    _resources = {
33
        'css': {
34
            'bootstrap': "https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"
35
        },
36
        'js': {
37
            'jquery': "https://code.jquery.com/jquery-3.4.1.slim.min.js",
38
            'bootstrap': "https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js",
39
        }
40
    }
41

42

43 7
class BootstrapDefaultTheme(DefaultTheme):
44

45 7
    _template = BootstrapTemplate
46

47

48 7
class BootstrapDarkTheme(DarkTheme):
49

50 7
    css = param.Filename(default=pathlib.Path(__file__).parent / 'dark.css')
51

52 7
    _template = BootstrapTemplate

Read our documentation on viewing source code .

Loading