Anchor(inner=None)
Name | Type | Description |
---|---|---|
inner |
str|WebComponent
|
The object wrapped by the anchor. |
The
Anchor
component is used for creating a hyperlink to pages, files,
email addresses, locations on the same page, or other web-resources
defined by a URL address. The
Bootwrap
also uses the
Anchor
in
conjunction with other components, for example, in creating a navigation
menu.
Anchor('Google Search').link('https://www.google.com/')
Change
Anchor
appearance using the following functions
as_primary()
,
as_secondary()
,
as_success()
,
as_warning()
,
as_danger()
,
as_info()
,
as_light()
, and
as_dark()
.
Associate
Anchor
with a hyperlink using the
link()
function.
Anchor("Google Search").link("https://www.google.com/")
Use
Anchor
to open a dialog using the
toggle()
function.
dialog = Dialog(
"Greeting",
"Hello World!"
)
anchor = Anchor("Say Hello").toggle(dialog)
Use
Anchor
to close a dialog using the
dismiss()
function.
dialog = Dialog(
"Greeting",
"Hello World!",
Anchor("Bye").dismiss()
)
anchor = Anchor("Say Hello").toggle(dialog)
Use
Anchor
to expand/collapse a panel using the
toggle()
function.
quote = Panel(
"Sometimes life is going to hit you in " +
"the head with a brick. Don’t lose faith."
).as_collapse()
Anchor("Steve Jobs Quote").toggle(quote)
Badge(label)
Name | Type | Description |
---|---|---|
label |
str
|
The badge label (text showing inside a badge). |
Badge('Some Badge')
Change
Badge
appearance using the following functions
as_primary()
,
as_secondary()
,
as_success()
,
as_warning()
,
as_danger()
,
as_info()
,
as_light()
, and
as_dark()
.
Badge("Primary").as_primary()
Badge("Secondary").as_secondary()
Badge("Success").as_success()
Badge("Warning").as_warning()
Badge("Danger").as_danger()
Badge("Info").as_info()
Badge("Light").as_light()
Badge("Dark").as_dark()
Button(name)
Name | Type | Description |
---|---|---|
name |
str
|
The button name. |
Without applying a stylized method
Button
will be appearing very
similar to the
Anchor
.
Button('Google Search').link('https://www.google.com/')
Change
Button
appearance using the following functions
as_primary()
,
as_secondary()
,
as_success()
,
as_warning()
,
as_danger()
,
as_info()
,
as_light()
, and
as_dark()
.
Make
Button
without filling with surrounded by color border using the following function
as primary()
.
Button("Primary").as_primary().as_outline()
Button("Secondary").as_secondary().as_outline()
Button("Success").as_success().as_outline()
Button("Warning").as_warning().as_outline()
Button("Danger").as_danger().as_outline()
Button("Info").as_info().as_outline()
Button("Light").as_light().as_outline()
Button("Dark").as_dark().as_outline()
But default the
Button
always enabled. Use the
as_disabled()
function to make the
Button
disabled. Disable status prevent user to initiate any action assigned to the
Button
.
Button("Enabled").as_primary()
Button("Disabled").as_primary().as_disabled()
Associate
Button
with a hyperlink using the
link()
function.
Button("Google Search").as_primary().link("https://www.google.com/")
Use
Button
to open a dialog using the
toggle()
function.
dialog = Dialog(
"Greeting",
"Hello World!"
)
button = Button("Say Hello").as_primary().toggle(dialog)
Use
Button
to close a dialog using the
dismiss()
function.
dialog = Dialog(
"Greeting",
"Hello World!",
Button("Bye").as_primary().dismiss()
)
button = Button("Say Hello").as_primary().toggle(dialog)
Use
Button
to expand/collapse a panel using the
toggle()
function.
quote = Panel(
"Sometimes life is going to hit you in " +
"the head with a brick. Don’t lose faith."
).as_collapse()
Button("Steve Jobs Quote").as_primary().toggle(quote)
Use
Button
to submit form content using the
submit()
function.
Note:
to make a form submit do not forget to use the
Form
function
on_submit()
, which specifies a URL that handles the post request. For more information view the
Form
documentation.
Form(
TextInput("Email", "email", "my@email.com").for_email(),
Button("Send").as_primary().submit()
)
Deck(*cards)
Name | Type | Description |
---|---|---|
*cards |
list
|
The
list
of
Deck.Card
elements.
|
from bootwrap import Button, Deck, Image
actions = [
Button("Buy"),
Button("Sell"),
Button("Transfer")
]
Deck(
Deck.Card(
"Google (NASDAQ: GOOGL)",
description= "Price for a single Google share",
figure=Image("google-logo.png", width=128).mt(3),
marker="12:04:58 12/01/2021"
).add_menu(*actions).pack_actions().link(
"https://www.google.com"),
Deck.Card(
"LinkedIn (NASDAQ: LNKD)",
description= "Price for a single LinkedIn share",
figure=Image("linkedin-logo.png", width=128).mt(3),
marker="12:04:58 12/01/2021"
).add_menu(*actions).pack_actions().link(
"https://www.linkedin.com"),
Deck.Card(
"Amazon (NASDAQ: AMZN)",
description= "Price for a single Amazon share",
figure=Image("amazon-logo.png", width=128).mt(3),
marker="12:04:58 12/01/2021"
).add_menu(*actions).pack_actions().link(
"https://www.amazon.com")
)
Deck.Card(title, description=None, marker=None, figure=None)
Name | Type | Description |
---|---|---|
title |
str|WebComponent
|
The card title. |
description |
str|WebComponent
|
The card description. |
marker |
str|WebComponent
|
The card marker. |
figure |
str|WebComponent
|
The card figure. |
from bootwrap import Button, Deck, Image
actions = [
Button("Buy"),
Button("Sell"),
Button("Transfer")
]
Deck.Card(
"Google (NASDAQ: GOOGL)",
description= "Price for a single Google share",
figure=Image("google-logo.png", width=128).mt(3),
marker="12:04:58 12/01/2021"
).add_menu(*actions).link(
"https://www.google.com")
pack_actions()
from bootwrap import Button, Deck, Image
actions = [
Button("Buy"),
Button("Sell"),
Button("Transfer")
]
Deck.Card(
"Google (NASDAQ: GOOGL)",
description= "Price for a single Google share",
figure=Image("google-logo.png", width=128).mt(3),
marker="12:04:58 12/01/2021"
).add_menu(*actions).pack_actions().link(
"https://www.google.com")
Dialog(title, content, *actions)
Name | Type | Description |
---|---|---|
title |
str
|
The dialog title. |
content |
str|WebComponent
|
The content inside a dialog window to show. |
*actions |
list
|
The dialog actions. |
from bootwrap import Dialog, Button
dialog = Dialog(
'Greeting',
'Hello World!',
Button('Bye').dismiss()
)
button = Button('Say Hello').toggle(dialog)
An example of how
Dialog
can be used for confirming a specific action. Make sure that you provide a correct URL, which
Confirm
Button
linked to. You can specify define this URL something like this
local/file_system?file_id=1234567&action=delete
from bootwrap import Dialog, Button
dialog = Dialog(
"Delete File",
"Are you sure?",
Button("Confirm").as_danger().link("url/to/act")
Button("Cancel").dismiss()
).as_danger()
button = Button("Delete").as_danger().toggle(dialog)
An example of how
Dialog
can be used for buying shares. It contains a web
Form
where a user can specify an amount (in Dollars) for buying shares. When the user presses the
Buy
Button
, the form will be submitted to the server (at
url/to/act
). If the user selects
Cancel
, the dialog will be closed, discarding the buying action.
from bootwrap import Form, NumericInput, Dialog, Button
dialog = Dialog(
"Buy Company Shares",
Form(
NumericInput(
"Amount($)",
"amount",
placeholder=\
"enter an amount for buying shares"
),
Button("Cancel").add_classes("float-right").dismiss(),
Button("Buy").add_classes("float-right).mr(2).as_success().
submit()
).on_submit("url/to/act")
)
button = Button("Buy Shares").as_primary().toggle(dialog)
Form(*components)
Name | Type | Description |
---|---|---|
*components |
list
|
The list of
WebComponent
representing form
elements for input and action.
|
Use the
on_submit(href)
function to specify URL where entered
information should to be sent for processing.
from bootwrap import Form
Form(
# here should be an enumeration of
# input components and actions
...
).on_submit('go/to/this/url')
on_submit(href)
Name | Type | Description |
---|---|---|
href |
str
|
The URL for submitting the form. |
Name | Type | Description |
---|---|---|
obj |
self
|
The instance of this class. |
from bootwrap import Form
Form(...).on_submit('go/to/this/url')
CheckboxInput(label, name, checked=False)
Name | Type | Description |
---|---|---|
label |
str
|
The input label. |
name |
str
|
The input name. |
checked |
bool
|
The check box status. |
Use the
as_disabled()
function to prevent the user from changing
status of the
CheckboxInput
component.
from bootwrap import Form, CheckboxInput
Form(
CheckboxInput('One', 'opt1'),
CheckboxInput('Two', 'opt2', True),
CheckboxInput('Three', 'opt3').as_disabled()
)
TextInput(label, name, value=None, placeholder=None)
Name | Type | Description |
---|---|---|
label |
str
|
The input label |
name |
str
|
The input name. |
value |
str
|
The input value. |
placeholder |
str
|
The input placeholder. |
Use the
as_disabled()
function to prevent the user from entering data
to the
TextInput
component.
from bootwrap import Form, TextInput
Form(
TextInput('Text1', 'text'),
TextInput('Text2', 'text', placeholder='type here'),
TextInput('Text3', 'text', 'Hello World!'),
TextInput('Text4', 'text').as_disabled()
)
for_email()
Name | Type | Description |
---|---|---|
obj |
self
|
The instance of this class. |
from bootwrap import Form, TextInput
Form(
TextInput('Email', 'email', 'my@email.com').for_email()
)
for_password()
Name | Type | Description |
---|---|---|
obj |
self
|
The instance of this class. |
from bootwrap import Form, TextInput
Form(
TextInput('Password', 'password', '********').for_password()
)
with_multirows(n)
Name | Type | Description |
---|---|---|
n |
int
|
The number of rows to set. |
Name | Type | Description |
---|---|---|
obj |
self
|
The instance of this class. |
from bootwrap import Form, TextInput
Form(
TextInput('Text', 'text').with_multirows(3)
)
NumericInput(label, name, value=None, placeholder=None)
Name | Type | Description |
---|---|---|
label |
str
|
The input label |
name |
str
|
The input name. |
value |
obj
|
The input value. |
placeholder |
str
|
The input placeholder. |
Use the
as_disabled()
function to prevent the user from entering data
to the
NumericInput
component.
from bootwrap import Form, TextInput
Form(
NumericInput('Number1', 'number'),
NumericInput('Number2', 'number', placeholder='type here'),
NumericInput('Number3', 'number', 123),
NumericInput('Number4', 'number').as_disabled()
)
SelectInput(label, name, value=None, options=None)
Name | Type | Description |
---|---|---|
label |
str
|
The input label |
name |
str
|
The input name. |
value |
str
|
The input value. |
options |
tuple
|
The input options. |
Use the
as_disabled()
function to prevent the user from entering data
to the
SelectInput
component.
from bootwrap import Form, SelectInput
options = [
SelectInput.Option('One', 1),
SelectInput.Option('Two', 2),
SelectInput.Option('Three', 3, disabled=True)
]
Form(
SelectInput('Selector1', 'choice', 2, options)
SelectInput('Selector2', 'choice', 2, options).as_disabled()
)
as_radio()
Name | Type | Description |
---|---|---|
obj |
self
|
The instance of this class. |
from bootwrap import Form, SelectInput
options = [
SelectInput.Option('One', 1),
SelectInput.Option('Two', 2),
SelectInput.Option('Three', 3, disabled=True)
]
Form(
SelectInput('Selector', 'choice', 2, options).as_radio()
)
SelectInput
.
SelectInput.Option(name, value, disabled=False)
Name | Type | Description |
---|---|---|
name |
str
|
The option name. |
value |
str
|
The option value value. |
disabled |
bool
|
True
makes the option disabled (in other words
user will not be able to choose this option).
|
HiddenInput(name, value=None)
Name | Type | Description |
---|---|---|
name |
str
|
The input name. |
value |
obj
|
The input value. |
from bootwrap import Form, SelectInput
Form(
HiddenInput('token', '123')
)
FileInput(label, name)
Name | Type | Description |
---|---|---|
label |
str
|
The input label |
name |
str
|
The input name. |
Use the
as_disabled()
function to prevent the user from entering data
to the
FileInput
component.
from bootwrap import Form, FileInput
output = Form(
FileInput('File', 'file'),
FileInput('File', 'file').as_disabled()
)
Icon(name)
Name | Type | Description |
---|---|---|
name |
str
|
The icon name. |
from bootwrap import Icon
Icon("fas fa-folder")
Icon("fas fa-folder").as_primary()
Icon("fas fa-folder").as_secondary()
Icon("fas fa-folder").as_success()
Icon("fas fa-folder").as_warning()
Icon("fas fa-folder").as_danger()
Icon("fas fa-folder").as_info()
Icon("fas fa-folder").as_light()
Icon("fas fa-folder").as_dark()
Spinner()
from bootwrap import Spinner
Spinner()
Spinner().as_primary()
Spinner().as_secondary()
Spinner().as_success()
Spinner().as_warning()
Spinner().as_danger()
Spinner().as_info()
Spinner().as_light()
Spinner().as_dark()
Image(src, width=None, height=None, alt=None)
Name | Type | Description |
---|---|---|
src |
obj
|
The image source to show. |
width |
int
|
The image width. |
height |
int
|
The image height. |
alt |
str
|
The alt text. |
from bootwrap import Image
Image("logo.png", width=64, height=64, alt="Bootwarp Logo")
Javascript(src=None, script=None, submap=None)
Name | Type | Description |
---|---|---|
src |
str
|
The URL to load javascript. A URL can be absolute or relative. |
script |
str
|
The javascript code. |
submap |
dict
|
The map with substitutions, binding the javascript with Python objects. |
from bootwrap import Page, Javascript
my_page = Page(
...
resources = [
Javascript("https://ajax...0/jquery.min.js")
]
...
)
Use
Javascript
for creating interactive web content with the help of jQuery.
from bootwrap import Javascript, Button, Text
label = Text("Answer:").as_strong()
answer = Text("unknown").mr(2).ml(2)
btn_yes = Button("Yes").as_success()
btn_no = Button("No").as_danger()
action = Javascript(
script='''
$("#btn_yes").on("click",function(){
$("#answer").text("Yes");
});
$("#btn_no").on("click",function(){
$("#answer").text("No");
});
'''
submap={
"answer": answer,
"btn_yes": btn_yes,
"btn_no": btn_no
}
)
Panel(
label, answer, btn_yes, btn_no, action
)
Link(href, rel='stylesheet', ctype='text/css')
Name | Type | Description |
---|---|---|
href |
str
|
This attribute specifies the URL of the linked resource. A URL can be absolute or relative (from MDN WebDoc). |
rel |
str
|
This attribute names a relationship of the linked document to the current document (from MDN WebDoc). |
ctype |
str
|
This attribute is used to define the type of the content linked to (from MDN WebDoc). |
See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link for more information.
from bootwrap import Page, Link
my_page = Page(
...
resources = [
Link("https://cdnjs.cloudflare.com/.../all.min.css")
]
...
)
List(*items)
Name | Type | Description |
---|---|---|
*items |
list
|
The
list
of
List.Item
elements.
|
from bootwrap import Button, List, Image
actions = [
Button("Buy"),
Button("Sell"),
Button("Transfer")
]
List(
List.Item(
"Google (NASDAQ: GOOGL)",
description= "Price for a single Google share",
figure=Image("google-logo.png", width=32, height=32),
marker="12:04:58 12/01/2021"
).add_menu(*actions).pack_actions().as_selected().link(
"https://www.google.com"),
List.Item(
"LinkedIn (NASDAQ: LNKD)",
description= "Price for a single LinkedIn share",
figure=Image("linkedin-logo.png", width=32, height=32),
marker="12:04:58 12/01/2021"
).add_menu(*actions).pack_actions().link(
"https://www.linkedin.com"),
List.Item(
"Amazon (NASDAQ: AMZN)",
description= "Price for a single Amazon share",
figure=Image("amazon-logo.png", width=32, height=32),
marker="12:04:58 12/01/2021"
).add_menu(*actions).pack_actions().link(
"https://www.amazon.com")
)
List.Item(title, description=None, marker=None, figure=None)
Name | Type | Description |
---|---|---|
title |
str|WebComponent
|
The item title. |
description |
str|WebComponent
|
The item description. |
marker |
str|WebComponent
|
The item marker. |
figure |
str|WebComponent
|
The item figure. |
from bootwrap import Button, List, Image
actions = [
Button("Buy"),
Button("Sell"),
Button("Transfer")
]
List.Item(
"Google (NASDAQ: GOOGL)",
description= "Price for a single Google share",
figure=Image("google-logo.png", width=32, height=32),
marker="12:04:58 12/01/2021"
).add_menu(*actions).link(
"https://www.google.com")
as_selected()
from bootwrap import Button, List, Image
actions = [
Button("Buy"),
Button("Sell"),
Button("Transfer")
]
List.Item(
"Google (NASDAQ: GOOGL)",
description= "Price for a single Google share",
figure=Image("google-logo.png", width=32, height=32),
marker="12:04:58 12/01/2021"
).add_menu(*actions).as_selected().link(
"https://www.google.com")
pack_actions()
from bootwrap import Button, List, Image
actions = [
Button("Buy"),
Button("Sell"),
Button("Transfer")
]
List.Item(
"Google (NASDAQ: GOOGL)",
description= "Price for a single Google share",
figure=Image("google-logo.png", width=32, height=32),
marker="12:04:58 12/01/2021"
).add_menu(*actions).pack_actions().link(
"https://www.google.com")
Navigation(*items)
Name | Type | Description |
---|---|---|
*items |
list
|
The list of
Navigation.Item
.
|
from bootwrap import Navigation
Navigation(
Navigation.Item('Chapter 1', 'Text 1', True),
Navigation.Item('Chapter 2', 'Text 2'),
Navigation.Item('Chapter 3', 'Text 3')
)
as_pills()
Name | Type | Description |
---|---|---|
obj |
self
|
The instance of this class. |
from bootwrap import Navigation
Navigation(
Navigation.Item('Chapter 1', 'Text 1', True),
Navigation.Item('Chapter 2', 'Text 2'),
Navigation.Item('Chapter 3', 'Text 3')
).as_pills()
as_tabs()
Name | Type | Description |
---|---|---|
obj |
self
|
The instance of this class. |
from bootwrap import Navigation
Navigation(
Navigation.Item('Chapter 1', 'Text 1', True),
Navigation.Item('Chapter 2', 'Text 2'),
Navigation.Item('Chapter 3', 'Text 3')
).as_tabs()
as_vertical()
Name | Type | Description |
---|---|---|
obj |
self
|
The instance of this class. |
from bootwrap import Navigation
Navigation(
Navigation.Item('Chapter 1', 'Text 1', True),
Navigation.Item('Chapter 2', 'Text 2'),
Navigation.Item('Chapter 3', 'Text 3')
).as_vertical()
Navigation.Item(name, content, active=False)
Panel(*components)
Name | Type | Description |
---|---|---|
*components |
list
|
The list of
WebComponent
.
|
from bootwrap import Text, Panel
comp1 = Text("Component 1")
comp2 = Text("Component 2")
comp3 = Text("Component 3")
Panel(comp1, comp2, comp3)
as_collapse()
Name | Type | Description |
---|---|---|
obj |
self
|
The instance of this class. |
horizontal()
Name | Type | Description |
---|---|---|
obj |
self
|
The instance of this class. |
from bootwrap import Text, Panel
comp1 = Text("Component 1")
comp2 = Text("Component 2")
comp3 = Text("Component 3")
Panel(comp1, comp2, comp3).horizontal()
vertical()
Name | Type | Description |
---|---|---|
obj |
self
|
The instance of this class. |
from bootwrap import Text, Panel
comp1 = Text("Component 1")
comp2 = Text("Component 2")
comp3 = Text("Component 3")
Panel(comp1, comp2, comp3).vertical()
Separator()
from bootwrap import Separator, Text
Text("Top Text")
Separator()
Text("Bottom Text")
Table(head, body)
Name | Type | Description |
---|---|---|
head |
list
|
The table head (1D array). |
body |
list
|
The table body (2D array). |
from bootwrap import Table
Table(
["Column 1", "Column 2", "Column 3"],
[
["Value 11", "Value 12", "Value 13"],
["Value 21", "Value 22", "Value 23"],
["Value 31", "Value 32", "Value 33"],
]
)
Column 1 | Column 2 | Column 3 |
---|---|---|
Value 11 | Value 12 | Value 13 |
Value 21 | Value 22 | Value 23 |
Value 31 | Value 32 | Value 33 |
as_bordered()
Name | Type | Description |
---|---|---|
obj |
self
|
The instance of this class. |
from bootwrap import Table
Table(
["Column 1", "Column 2", "Column 3"],
[
["Value 11", "Value 12", "Value 13"],
["Value 21", "Value 22", "Value 23"],
["Value 31", "Value 32", "Value 33"],
]
).as_bordered()
Column 1 | Column 2 | Column 3 |
---|---|---|
Value 11 | Value 12 | Value 13 |
Value 21 | Value 22 | Value 23 |
Value 31 | Value 32 | Value 33 |
as_dark()
Name | Type | Description |
---|---|---|
obj |
self
|
The instance of this class. |
from bootwrap import Table
Table(
["Column 1", "Column 2", "Column 3"],
[
["Value 11", "Value 12", "Value 13"],
["Value 21", "Value 22", "Value 23"],
["Value 31", "Value 32", "Value 33"],
]
).as_dark()
Column 1 | Column 2 | Column 3 |
---|---|---|
Value 11 | Value 12 | Value 13 |
Value 21 | Value 22 | Value 23 |
Value 31 | Value 32 | Value 33 |
as_responsive(breakpoint=)
Name | Type | Description |
---|---|---|
breakpoint |
str
|
The breakpoint to apply. |
Name | Type | Description |
---|---|---|
obj |
self
|
The instance of this class. |
from bootwrap import Table
Table(
["Column 1", "Column 2", "Column 3"],
[
["Value 11", "Value 12", "Value 13"],
["Value 21", "Value 22", "Value 23"],
["Value 31", "Value 32", "Value 33"],
]
).as_responsive()
Column 1 | Column 2 | Column 3 |
---|---|---|
Value 11 | Value 12 | Value 13 |
Value 21 | Value 22 | Value 23 |
Value 31 | Value 32 | Value 33 |
as_small()
Name | Type | Description |
---|---|---|
obj |
self
|
The instance of this class. |
from bootwrap import Table
Table(
["Column 1", "Column 2", "Column 3"],
[
["Value 11", "Value 12", "Value 13"],
["Value 21", "Value 22", "Value 23"],
["Value 31", "Value 32", "Value 33"],
]
).as_small()
Column 1 | Column 2 | Column 3 |
---|---|---|
Value 11 | Value 12 | Value 13 |
Value 21 | Value 22 | Value 23 |
Value 31 | Value 32 | Value 33 |
as_striped()
Name | Type | Description |
---|---|---|
obj |
self
|
The instance of this class. |
from bootwrap import Table
Table(
["Column 1", "Column 2", "Column 3"],
[
["Value 11", "Value 12", "Value 13"],
["Value 21", "Value 22", "Value 23"],
["Value 31", "Value 32", "Value 33"],
]
).as_striped()
Column 1 | Column 2 | Column 3 |
---|---|---|
Value 11 | Value 12 | Value 13 |
Value 21 | Value 22 | Value 23 |
Value 31 | Value 32 | Value 33 |
Table.Head(head)
as_dark()
from bootwrap import Table
table = Table(
["Column 1", "Column 2", "Column 3"],
[
["Value 11", "Value 12", "Value 13"],
["Value 21", "Value 22", "Value 23"],
["Value 31", "Value 32", "Value 33"],
]
)
table.head.as_dark()
Column 1 | Column 2 | Column 3 |
---|---|---|
Value 11 | Value 12 | Value 13 |
Value 21 | Value 22 | Value 23 |
Value 31 | Value 32 | Value 33 |
as_light()
from bootwrap import Table
table = Table(
["Column 1", "Column 2", "Column 3"],
[
["Value 11", "Value 12", "Value 13"],
["Value 21", "Value 22", "Value 23"],
["Value 31", "Value 32", "Value 33"],
]
)
table.head.as_light()
Column 1 | Column 2 | Column 3 |
---|---|---|
Value 11 | Value 12 | Value 13 |
Value 21 | Value 22 | Value 23 |
Value 31 | Value 32 | Value 33 |
Table.Body(body)
transform(index, entity, fn)
Name | Type | Description |
---|---|---|
index |
int
|
The column index to which transformation is applied; |
entity |
Entity
|
The entity to which transformation is applied; |
fn |
func
|
The function to use for transformation. |
from bootwrap import Table, TableEntity, Text
table = Table(
["Column 1", "Column 2", "Column 3"],
[
["val1", "int", "this is a description for val1;"],
["val2", "str", "this is a description for val2;"],
["val3", "bool", "this is a description for val3;"],
]
)
table.body.transform(
0,
TableEntity.CELL,
lambda v: "font-weight-bold" if v.startswith("val") else ""
)
table.body.transform(
0,
TableEntity.ROW,
lambda v: "bg-warning" if v == "val2" else ""
)
table.body.transform(
1,
TableEntity.VALUE,
lambda v: f"{v}
"
Column 1 | Column 2 | Column 3 |
---|---|---|
val1 |
int
|
this is a description for val1; |
val2 |
str
|
this is a description for val2; |
val3 |
bool
|
this is a description for val3; |
Text(content)
Name | Type | Description |
---|---|---|
content |
str
|
The textual content. |
from bootwrap import Text
Text("Normal text")
as_code()
Name | Type | Description |
---|---|---|
obj |
self
|
The instance of this class. |
from bootwrap import Text
Text("print('Hello world!')").as_code()
print('Hello world!')
as_heading(level)
Name | Type | Description |
---|---|---|
level |
int
|
The heading level; |
Name | Type | Description |
---|---|---|
obj |
self
|
The instance of this class. |
from bootwrap import Text
Text("Header text 1").as_heading(1)
Text("Header text 2").as_heading(2)
Text("Header text 3").as_heading(3)
Text("Header text 4").as_heading(4)
Text("Header text 5").as_heading(5)
Text("Header text 6").as_heading(6)
as_muted()
Name | Type | Description |
---|---|---|
obj |
self
|
The instance of this class. |
from bootwrap import Text
Text("Muted text").as_muted()
as_paragraph()
Name | Type | Description |
---|---|---|
obj |
self
|
The instance of this class. |
from bootwrap import Text
Text("Paragraph 1").as_paragraph()
Text("Paragraph 2").as_paragraph()
Text("Paragraph 3").as_paragraph()
Paragraph 1
Paragraph 2
Paragraph 3
as_small()
Name | Type | Description |
---|---|---|
obj |
self
|
The instance of this class. |
from bootwrap import Text
Text("Small text").as_small()
as_strong()
Name | Type | Description |
---|---|---|
obj |
self
|
The instance of this class. |
from bootwrap import Text
Text("Strong text").as_strong()