Advanced Usage¶
Form Checkbox Customization¶
Rendering Switch¶
Bootstrap offers the rendering of a checkbox (or check) as a
switch. In
Bootstrap-Flask, simply use the built-in class SwitchField()
instead of
BooleanField()
. See also the example application.
Bootswatch Themes¶
Bootswatch is a collection of free and open source themes for Bootstrap. If you are using bootstrap.load_css()
to include
Bootstrap resources. Then you can set Bootswatch theme with configuration variable BOOTSTRAP_BOOTSWATCH_THEME
.
The available theme names are: ‘cerulean’, ‘cosmo’, ‘cyborg’, ‘darkly’, ‘flatly’, ‘journal’, ‘litera’, ‘lumen’, ‘lux’, ‘materia’, ‘minty’, ‘pulse’, ‘sandstone’, ‘simplex’, ‘sketchy’, ‘slate’, ‘solar’, ‘spacelab’, ‘superhero’, ‘united’, ‘yeti’.
For Bootstrap 5, besides these, you can also use: ‘morph’, ‘quartz’, ‘vapor’, ‘zephyr’.
Here is an example to use lumen
theme:
app.config['BOOTSTRAP_BOOTSWATCH_THEME'] = 'lumen'
You can find these themes on https://bootswatch.com.