Package: lona-bootstrap-5
This package containsLonanodes and widgets forBootstrap 5.Supported components:Grid SystemTextInputs and TextareasButtonsSpinnersAlertsBadgesModalProgressGrid SystemUpstream documentation:Linkfromlona_bootstrap_5importColMd6,Col,RowRow(ColMd6('foo'),ColMd6('bar'),)Row(Col('foo'),Col('bar'),Col('baz'),)TextInputs and TextAreasUpstream documentation:LinkTextInputandTextAreawork exactly likeLona TextInputsand are just styled by Bootstrap.fromlona_bootstrap_5importTextInput,TextAreasButtonsUpstream documentation:LinkButtonworks exactly likeLona Buttonand is just styled by Bootstrap.fromlona_bootstrap_5import(PrimaryButton,SecondaryButton,SuccessButton,WarningButton,DangerButton,InfoButton,LightButton,DarkButton,LinkButton,)SpinnersUpstream documentation:LinkThe first argument will be shown to screen readers, if no arguments are passed the default is “Loading…”fromlona_bootstrap_5import(GrowPrimarySpinner,GrowSecondarySpinner,GrowSuccessSpinner,GrowDangerSpinner,GrowWarningSpinner,GrowInfoSpinner,GrowLightSpinner,GrowDarkSpinner,BorderPrimarySpinner,BorderSecondarySpinner,BorderSuccessSpinner,BorderDangerSpinner,BorderWarningSpinner,BorderInfoSpinner,BorderLightSpinner,BorderDarkSpinner,)GrowPrimarySpinner("Loading the page...")AlertsUpstream documentation:Linkfromlona_bootstrap_5import(PrimaryAlert,SecondaryAlert,SuccessAlert,DangerAlert,WarningAlert,InfoAlert,LightAlert,DarkAlert,)BadgesUpstream documentation:Linkfromlona_bootstrap_5import(PrimaryBadge,SecondaryBadge,SuccessBadge,DangerBadge,WarningBadge,InfoBadge,LightBadge,DarkBadge,)ModalUpstream documentation:Linkfromlona_bootstrap_5importModalModal(fade=True,scrollable=False,centered=False)PropertiesModal.fade: (bool) IfTruemodal is animatedModal.centered: (bool) IfTruemodal is vertically centredModal.scrollable: (bool) IfTruemodal is scrollableModal.buttons: (list) Contains all buttons added usingModal.set_buttons()MethodsModal.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)Examplefromlona_bootstrap_5importModal,PrimaryButtonfromlonaimportLonaView,LonaAppfromlona.htmlimportHTML,H1app=LonaApp(__file__)@app.route('/')classMyModalView(LonaView):defhandle_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 clickedself.await_click()# button was clicked; show modalwithhtml.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 clickedself.await_click(modal.buttons)# modal button was clicked; hide modalmodal.hide()returnhtmlapp.run(port=8080)ProgressUpstream documentation:Linkfromlona_bootstrap_5importProgressProgress(*label,background=None,value=None,percentage=None,striped=False,animated=False)PropertiesModal.background: (str) [‘’|success|info|warning|danger]Modal.value: (int) Current progress value between0and100Modal.striped: (bool) Enables BootstrapsstripedstyleModal.animated: (bool) Enables Bootstrap animationsMethodsModal.set_labal(*nodes): Sets labelModal.set_percentage(percentage): Sets the value the given value and callsModal.set_label()