This package contains Lona nodes and widgets for Bootstrap 5.
Supported components:
Upstream documentation: Link
from lona_bootstrap_5 import ColMd6, Col, Row
Row(
ColMd6('foo'),
ColMd6('bar'),
)
Row(
Col('foo'),
Col('bar'),
Col('baz'),
)
Upstream documentation: Link
TextInput
and TextArea
work exactly like
Lona TextInputs
and are just styled by Bootstrap.
from lona_bootstrap_5 import TextInput, TextAreas
Upstream documentation: Link
Button
works exactly like
Lona Button
and is just styled by Bootstrap.
from lona_bootstrap_5 import (
PrimaryButton,
SecondaryButton,
SuccessButton,
WarningButton,
DangerButton,
InfoButton,
LightButton,
DarkButton,
LinkButton,
)
Upstream documentation: Link
The first argument will be shown to screen readers, if no arguments are passed the default is "Loading..."
from lona_bootstrap_5 import (
GrowPrimarySpinner,
GrowSecondarySpinner,
GrowSuccessSpinner,
GrowDangerSpinner,
GrowWarningSpinner,
GrowInfoSpinner,
GrowLightSpinner,
GrowDarkSpinner,
BorderPrimarySpinner,
BorderSecondarySpinner,
BorderSuccessSpinner,
BorderDangerSpinner,
BorderWarningSpinner,
BorderInfoSpinner,
BorderLightSpinner,
BorderDarkSpinner,
)
GrowPrimarySpinner("Loading the page...")
Upstream documentation: Link
from lona_bootstrap_5 import (
PrimaryAlert,
SecondaryAlert,
SuccessAlert,
DangerAlert,
WarningAlert,
InfoAlert,
LightAlert,
DarkAlert,
)
Upstream documentation: Link
from lona_bootstrap_5 import (
PrimaryBadge,
SecondaryBadge,
SuccessBadge,
DangerBadge,
WarningBadge,
InfoBadge,
LightBadge,
DarkBadge,
)
Upstream documentation: Link
from lona_bootstrap_5 import Modal
Modal(fade=True, scrollable=False, centered=False)
Modal.fade
: (bool) IfTrue
modal is animatedModal.centered
: (bool) IfTrue
modal is vertically centredModal.scrollable
: (bool) IfTrue
modal is scrollableModal.buttons
: (list) Contains all buttons added usingModal.set_buttons()
Modal.show()
: Makes the modal visible (modals are invisible by default)Modal.hide()
: Makes the modal invisible (modals are invisible by default)Modal.set_title(*nodes)
: Sets the modal titleModal.set_body(*nodes)
: Sets the modal bodyModal.set_buttons(*buttons)
: Sets the modal buttons (set buttons are available inModal.buttons
)
from lona_bootstrap_5 import Modal, PrimaryButton
from lona import LonaView, LonaApp
from lona.html import HTML, H1
app = LonaApp(__file__)
@app.route('/')
class MyModalView(LonaView):
def handle_request(self, request):
modal = Modal()
html = HTML(
H1('My Modal'),
PrimaryButton('Open Modal', _id='open-modal'),
modal,
)
self.show(html)
# wait for button to be clicked
self.await_click()
# button was clicked; show modal
with html.lock:
modal.set_title('My Modal')
modal.set_body('Lorem Ipsum')
modal.set_buttons(
PrimaryButton('Close')
)
modal.show()
self.show(html)
# wait for modal button to be clicked
self.await_click(modal.buttons)
# modal button was clicked; hide modal
modal.hide()
return html
app.run(port=8080)
Upstream documentation: Link
from lona_bootstrap_5 import Progress
Progress(*label, background=None, value=None, percentage=None,
striped=False, animated=False)
Modal.background
: (str) [''|success|info|warning|danger]Modal.value
: (int) Current progress value between0
and100
Modal.striped
: (bool) Enables Bootstrapsstriped
styleModal.animated
: (bool) Enables Bootstrap animations
Modal.set_labal(*nodes)
: Sets labelModal.set_percentage(percentage)
: Sets the value the given value and callsModal.set_label()