-
Notifications
You must be signed in to change notification settings - Fork 1
/
bulma.py
50 lines (34 loc) · 1.29 KB
/
bulma.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
"""Bulma CSS framework components for FastHTML."""
from fasthtml.common import ft_hx
def kw(kwargs, cls):
if 'cls' in kwargs:
kwargs['cls'] = f"{kwargs['cls']} {cls}"
else:
kwargs['cls'] = cls
return kwargs
def Container(*c, **kwargs):
return ft_hx('div', *c, cls='', **kwargs)
def Button(*c, **kwargs):
return ft_hx('button', *c, cls='button', **kwargs)
def Textarea(*c, **kwargs):
return ft_hx('textarea', *c, cls='textarea', **kwargs)
def Input(*c, **kwargs):
return ft_hx('input', *c, cls='input', **kwargs)
def Label(*c, **kwargs):
return ft_hx('label', *c, cls='label', **kwargs)
def Card(*c, **kwargs):
return ft_hx('div', *c, cls='card', **kwargs)
def CardHeader(*c, **kwargs):
return ft_hx('header', *c, cls='card-header', **kwargs)
def CardHeaderTitle(*c, **kwargs):
return ft_hx('p', *c, cls='card-header-title', **kwargs)
def CardContent(*c, **kwargs):
return ft_hx('div', *c, cls='card-content', **kwargs)
def Grid(*c, **kwargs):
return ft_hx('div', *c, cls='grid', **kwargs)
def Cell(*c, **kwargs):
return ft_hx('div', *c, **kw(kwargs, cls='cell'))
def Columns(*c, **kwargs):
return ft_hx('div', *c, **kw(kwargs, cls='columns'))
def Column(*c, **kwargs):
return ft_hx('div', *c, **kw(kwargs, cls='column'))