Class Anchor

A web component for an anchor.
Anchor(inner=None)
Arguments
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.

Example
from bootwrap import Anchor
Anchor('Google Search').link('https://www.google.com/')

Appearance

Change Anchor appearance using the following functions as_primary() , as_secondary() , as_success() , as_warning() , as_danger() , as_info() , as_light() , and as_dark() .

from bootwrap import Panel, Anchor
panel = Panel(
  Anchor("Primary").link("#").as_primary(),
  Anchor("Secondary").link("#").as_secondary(),
  Anchor("Success").link("#").as_success(),
  Anchor("Warning").link("#").as_warning(),
  Anchor("Danger").link("#").as_danger(),
  Anchor("Info").link("#").as_info(),
  Anchor("Light").link("#").as_light(),
  Anchor("Dark").link("#").as_dark()
)
for anchor in panel:
  anchor.mb(1)
panel

Link Resource

Associate Anchor with a hyperlink using the link() function.

from bootwrap import Panel, Anchor
Panel(
    Anchor("Google Search").link("https://www.google.com/")
)

Open Dialog

Use Anchor to open a dialog using the toggle() function.

from bootwrap import Panel, Dialog, Anchor
dialog = Dialog(
  "Greeting",
  "Hello World!"
)
anchor = Anchor("Say Hello").toggle(dialog)
Panel(dialog, anchor)
Say Hello

Close Dialog

Use Anchor to close a dialog using the dismiss() function.

from bootwrap import Panel, Dialog, Anchor
dialog = Dialog(
  "Greeting",
  "Hello World!",
  Anchor("Bye").dismiss()
)
anchor = Anchor("Say Hello").toggle(dialog)  
Panel(dialog, anchor)
Say Hello

Expand/Collapse Panel

Use Anchor to expand/collapse a panel using the toggle() function.

from bootwrap import Panel, Anchor
quote = Panel(
  "Sometimes life is going to hit you in " +
  "the head with a brick. Don’t lose faith."
).as_collapse()
Panel(
  Anchor("Steve Jobs Quote").toggle(quote),
  quote
)
Steve Jobs Quote
Sometimes life is going to hit you in the head with a brick. Don’t lose faith.

Class Badge

A web component for a badge.
Badge(label)
Arguments
Name Type Description
label str The badge label (text showing inside a badge).
Example
from bootwrap import Badge
Badge('Some Badge').as_dark()
Some Badge

Appearance

Change Badge appearance using the following functions as_primary() , as_secondary() , as_success() , as_warning() , as_danger() , as_info() , as_light() , and as_dark() .

from bootwrap import Panel, Badge
panel = Panel(
  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()
)
for anchor in panel:
  anchor.mb(1)
panel
Primary Secondary Success Warning Danger Info Light Dark

Class Button

A web component for a button.
Button(name)
Arguments
Name Type Description
name str The button name.

Without applying a stylized method Button will be appearing very similar to the Anchor .

Example
from bootwrap import Button
Button('Google Search').link('https://www.google.com/')

Appearance

Change Button appearance using the following functions as_primary() , as_secondary() , as_success() , as_warning() , as_danger() , as_info() , as_light() , and as_dark() .

from bootwrap import Panel, Button
panel = Panel(
  Button("Primary").link("#").as_primary(),
  Button("Secondary").link("#").as_secondary(),
  Button("Success").link("#").as_success(),
  Button("Warning").link("#").as_warning(),
  Button("Danger").link("#").as_danger(),
  Button("Info").link("#").as_info(),
  Button("Light").link("#").as_light(),
  Button("Dark").link("#").as_dark()
)
for anchor in panel:
  anchor.mb(1)
panel

Outline

Make Button without filling with surrounded by color border using the following function as primary() .

from bootwrap import Panel, Button
panel = Panel(
  Button("Primary").link("#").as_primary().as_outline(),
  Button("Secondary").link("#").as_secondary().as_outline(),
  Button("Success").link("#").as_success().as_outline(),
  Button("Warning").link("#").as_warning().as_outline(),
  Button("Danger").link("#").as_danger().as_outline(),
  Button("Info").link("#").as_info().as_outline(),
  Button("Light").link("#").as_light().as_outline(),
  Button("Dark").link("#").as_dark().as_outline()
)
for anchor in panel:
  anchor.mb(1)
panel

Disable

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 .

from bootwrap import Panel, Button
Panel(
  Button("Enabled").as_primary(),
  Button("Disabled").as_primary().as_disabled()
)

Link Resource

Associate Button with a hyperlink using the link() function.

from bootwrap import Panel, Button
Panel(
    Button("Google Search").as_primary().link("https://www.google.com/")
)

Open Dialog

Use Button to open a dialog using the toggle() function.

from bootwrap import Panel, Dialog, Button
dialog = Dialog(
  "Greeting",
  "Hello World!"
)
button = Button("Say Hello").as_primary().toggle(dialog)
Panel(dialog, button)

Close Dialog

Use Button to close a dialog using the dismiss() function.

from bootwrap import Panel, Dialog, Button
dialog = Dialog(
  "Greeting",
  "Hello World!",
  Button("Bye").as_primary().dismiss()
)
button = Button("Say Hello").as_primary().toggle(dialog)  
Panel(dialog, button)

Expand/Collapse Panel

Use Button to expand/collapse a panel using the toggle() function.

from bootwrap import Panel, Button
quote = Panel(
  "Sometimes life is going to hit you in " +
  "the head with a brick. Don’t lose faith."
).as_collapse()
Panel(
  Button("Steve Jobs Quote").as_primary().toggle(quote),
  quote
)
Sometimes life is going to hit you in the head with a brick. Don’t lose faith.

Submit Action

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.

from bootwrap import Form, TextInput, Button
Form(
  TextInput("Email", "email", "my@email.com").for_email(),
  Button("Send").as_primary().submit()
)

Class ButtonGroup

A web component for a button group.
ButtonGroup(*buttons)
Arguments
Name Type Description
*buttons list The list of WebComponent .

Group a series of buttons together on a single line or stack them in a vertical column.

Example
from bootwrap import Button, ButtonGroup

button1 = Button('One').as_success()
button2 = Button('Two').as_warning()
button3 = Button('Three').as_danger()

ButtonGroup(button1, button2, button3)

As check boxes

Group a series of buttons together, which act as check boxes.

from bootwrap import CheckboxInput, ButtonGroup

button1 = CheckboxInput('One', 'opt1').as_button().as_secondary()
button2 = CheckboxInput('Two', 'opt2').as_button().as_secondary()
button3 = CheckboxInput('Three', 'opt3').as_button().as_secondary()

ButtonGroup(button1, button2, button3)

As radio buttons

Group a series of buttons together, which act as radio buttons.

from bootwrap import CheckboxInput, ButtonGroup

button1 = CheckboxInput('One', 'opt').as_radio(1).as_button().as_secondary()
button2 = CheckboxInput('Two', 'opt').as_radio(2).as_button().as_secondary()
button3 = CheckboxInput('Three', 'opt').as_radio(3).as_button().as_secondary()

ButtonGroup(button1, button2, button3)

Class Deck

A web component for a deck of cards.
Deck(*cards)
Arguments
Name Type Description
*cards list The list of Deck.Card elements.
Example
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")
)
12:04:58 12/01/2021
Google (NASDAQ: GOOGL)
Price for a single Google share
12:04:58 12/01/2021
LinkedIn (NASDAQ: LNKD)
Price for a single LinkedIn share
12:04:58 12/01/2021
Amazon (NASDAQ: AMZN)
Price for a single Amazon share

Class Deck.Card

A deck card.
Deck.Card(title, description=None, marker=None, figure=None)
Arguments
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.
Example
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")
12:04:58 12/01/2021
Google (NASDAQ: GOOGL)
Price for a single Google share

Method pack_actions

Makes item actions packed under a drop-down menu.
pack_actions()
Example
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")
12:04:58 12/01/2021
Google (NASDAQ: GOOGL)
Price for a single Google share

Class Dialog

A dialog.
Dialog(title, content, *actions)
Arguments
Name Type Description
title str The dialog title.
content str|WebComponent The content inside a dialog window to show.
*actions list The dialog actions.
Example
from bootwrap import Panel, Dialog, Button

dialog = Dialog(
    'Greeting',
    'Hello World!',
    Button('Bye').dismiss()
)
button = Button('Say Hello').toggle(dialog)

Panel(dialog, button)

Question 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 Panel, Dialog, Button

dialog = Dialog(
  "Delete File",
  "Are you sure that you want to delete this file?",
  Button("Confirm").as_danger().dismiss(),
  Button("Cancel").dismiss()
).as_danger()

button = Button("Delete").as_danger().toggle(dialog)   

Panel(dialog, button)

Complex 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 Panel, 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").me(2).as_success().
          dismiss()
    )
)
button = Button("Buy Shares").as_primary().toggle(dialog)   

Panel(dialog, button)

Class Form

A web component for a form.
Form(*components)
Arguments
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.

Example
from bootwrap import Form

Form(
    # here should be an enumeration  of
    # input components and actions
    ...
).on_submit('go/to/this/url')

Method on_submit

Sets the submit URL, for the POST request.
on_submit(href)
Arguments
Name Type Description
href str The URL for submitting the form.
Returns
Name Type Description
obj self The instance of this class.
Example
from bootwrap import Form

Form(...).on_submit('go/to/this/url')

Class CheckboxInput

A checkbox input.
CheckboxInput(label, name, checked=False)
Arguments
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.

Example
from bootwrap import Form, CheckboxInput

Form(
    CheckboxInput('One', 'opt1'),
    CheckboxInput('Two', 'opt2', True),
    CheckboxInput('Three', 'opt3').as_disabled(),
    CheckboxInput('Four', 'opt4', True).as_disabled()
)

Method as_button

Sets the "button"-style to the check box.
as_button()
Returns
Name Type Description
obj self The instance of this class.
Example
from bootwrap import Form, CheckboxInput

Form(
    CheckboxInput('One', 'opt1').as_button().as_primary().as_outline(),
    CheckboxInput('Two', 'opt2', True).as_button(),
    CheckboxInput('Three', 'opt3').as_button().as_disabled(),
    CheckboxInput('Four', 'opt4', True).as_button().as_disabled()
)

Method as_radio

Makes a chack box as radio button.
as_radio(value)
Returns
Name Type Description
obj self The instance of this class.
Example
from bootwrap import Form, CheckboxInput

Form(
    CheckboxInput('One', 'opt').as_radio(1),
    CheckboxInput('Two', 'opt', True).as_radio(2),
    CheckboxInput('Three', 'opt').as_radio(3).as_disabled(),
    CheckboxInput('Four', 'opt', True).as_radio(4).as_disabled()
)

Method as_switch

Sets the "switch"-style to the check box.
as_switch()
Returns
Name Type Description
obj self The instance of this class.
Example
from bootwrap import Form, CheckboxInput

Form(
    CheckboxInput('One', 'opt1').as_switch(),
    CheckboxInput('Two', 'opt2', True).as_switch(),
    CheckboxInput('Three', 'opt3').as_switch().as_disabled(),
    CheckboxInput('Four', 'opt4', True).as_switch().as_disabled()
)

Method inline

Sets the check box in line.
inline()
Returns
Name Type Description
obj self The instance of this class.
Example
from bootwrap import Form, CheckboxInput

Form(
    CheckboxInput('One', 'opt1').inline(),
    CheckboxInput('Two', 'opt2', True).inline(),
    CheckboxInput('Three', 'opt3').inline().as_disabled(),
    CheckboxInput('Four', 'opt4', True).inline().as_disabled()
)

Class TextInput

A text input.
TextInput(label, name, value=None, placeholder=None)
Arguments
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.

Example
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()
)

Method for_email

Configuring input for entering email.
for_email()
Returns
Name Type Description
obj self The instance of this class.
Example
from bootwrap import Form, TextInput

Form(
    TextInput('Email', 'email', 'my@email.com').for_email()
)

Method for_password

Configuring input for entering password.
for_password()
Returns
Name Type Description
obj self The instance of this class.
Example
from bootwrap import Form, TextInput

Form(
    TextInput('Password', 'password', '********').for_password()
)

Method with_multirows

Sets the number of rows.
with_multirows(n)
Arguments
Name Type Description
n int The number of rows to set.
Returns
Name Type Description
obj self The instance of this class.
Example
from bootwrap import Form, TextInput

Form(
    TextInput('Text', 'text').with_multirows(3)
)

Class NumericInput

A numeric input.
NumericInput(label, name, value=None, placeholder=None)
Arguments
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.

Example
from bootwrap import Form, NumericInput

Form(
    NumericInput('Number1', 'number'),
    NumericInput('Number2', 'number', placeholder='type here'),
    NumericInput('Number3', 'number', 123),
    NumericInput('Number4', 'number').as_disabled()
)

Class SelectInput

A select input.
SelectInput(label, name, value=None, options=None)
Arguments
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.

Example
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()
)

Method as_radio

Makes selection in a form of radio buttons.
as_radio()
Returns
Name Type Description
obj self The instance of this class.
Example
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()
)

Class SelectInput.Option

An option used by SelectInput .
SelectInput.Option(name, value, disabled=False)
Arguments
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).

Property disabled

None

Property name

None

Property value

None

Class HiddenInput

A hidden input.
HiddenInput(name, value=None)
Arguments
Name Type Description
name str The input name.
value obj The input value.
Example
from bootwrap import Form, SelectInput

Form(
    HiddenInput('token', '123')
)

Class FileInput

A file input.
FileInput(label, name)
Arguments
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.

Example
from bootwrap import Form, FileInput

Form(
    FileInput('File', 'file'),
    FileInput('File', 'file').as_disabled()
)
Browse
Browse

Class InputGroup

A web component for an input group.
InputGroup(*inputs)
Arguments
Name Type Description
*components list The list of WebComponent .

Grous together a series of input components

Example
from bootwrap import Text, TextInput, NumericInput, InputGroup, Form

at = Text("@")
username = TextInput(None, 'username', placeholder='type username')
ig1 = InputGroup(at, username).mb(2)

recipient = TextInput(None, 'recipient', placeholder='Recipient username')
domain = Text("@example.com")
ig2 = InputGroup(recipient, domain).mb(2)

recipient = TextInput(None, 'recipient', placeholder='Recipient username')
domain = Text("@example.com")
ig2 = InputGroup(recipient, domain).mb(2)

money = Text("$")
amount = NumericInput(None, 'amount', placeholder='Amount (to the nearest dollar)')
cents = Text(".00")
ig3 = InputGroup(money, amount, cents).mb(2)

login = TextInput(None, 'login', placeholder='Login')
at = Text("@")
password = TextInput(None, 'password', placeholder='Password').for_password()
ig4 = InputGroup(login, at, password).mb(2)

Form(ig1,ig2,ig3,ig4)
@
@example.com
$ .00
@

Class Icon

An icon.
Icon(name)
Arguments
Name Type Description
name str The icon name.
Example
from bootwrap import Icon, Panel

Panel(
    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()
)

Class Spinner

A spinner icon.
Spinner()
Example
from bootwrap import Spinner, Panel

Panel(
    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()
)

Class Image

A web component for an image.
Image(src, width=None, height=None, alt=None)
Arguments
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.
Example
from bootwrap import Image

Image("logo.png")

Class Javascript

A web component for a javascript.
Javascript(src=None, script=None, submap=None)
Arguments
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.
Example
from bootwrap import Page, Javascript

my_page = Page(
    ...
    resources = [
        Javascript("https://ajax...0/jquery.min.js")
    ]
    ...
)

jQuery

Use Javascript for creating interactive web content with the help of jQuery.

from bootwrap import Panel, Javascript, Button, Text

label = Text("Answer:").as_strong()
answer = Text("unknown").me(2).ms(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
)
Answer: unknown

Class Link

A web component for an external resource link.
Link(href, rel='stylesheet', ctype='text/css')
Arguments
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.

Example
from bootwrap import Page, Link

my_page = Page(
    ...
    resources = [
        Link("https://cdnjs.cloudflare.com/.../all.min.css")
    ]
    ...
)

Class List

A web component for a list of items.
List(*items)
Arguments
Name Type Description
*items list The list of List.Item elements.
Example
from bootwrap import Button, List, Image

actions = [
    Button("Buy").as_success(),
    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")
)

Class List.Item

A list item.
List.Item(title, description=None, marker=None, figure=None)
Arguments
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.
Example
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).link("https://www.google.com")
)

Method as_selected

Makes a list item selected.
as_selected()
Example
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).as_selected().link(
        "https://www.google.com")
)

Method pack_actions

Makes item actions packed under a drop-down menu.
pack_actions()
Example
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().link(
        "https://www.google.com")
)

Class Navigation

A web component for navigation.
Navigation(*items)
Arguments
Name Type Description
*items list The list of Navigation.Item .
Example
from bootwrap import Navigation

Navigation(
    Navigation.Item('Chapter 1', 'Text 1', True),
    Navigation.Item('Chapter 2', 'Text 2'),
    Navigation.Item('Chapter 3', 'Text 3')
)

Method as_pills

Makes the navigation controls looks like buttons.
as_pills()
Returns
Name Type Description
obj self The instance of this class.
Example
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()

Method as_tabs

Makes the navigation controls looks like buttons.
as_tabs()
Returns
Name Type Description
obj self The instance of this class.
Example
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()

Method as_vertical

Makes the navigation vertical.
as_vertical()
Returns
Name Type Description
obj self The instance of this class.
Example
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()

Class Navigation.Item

None
Navigation.Item(name, content, active=False)

Property active

None

Property content

None

Property name

None

Class Panel

A web component for a panel.
Panel(*components)
Arguments
Name Type Description
*components list The list of WebComponent .
Example
from bootwrap import Text, Panel

comp1 = Text("Component 1").add_classes("border").ms(1)
comp2 = Text("Component 2").add_classes("border").ms(1)
comp3 = Text("Component 3").add_classes("border").ms(1)

Panel(comp1, comp2, comp3)
Component 1 Component 2 Component 3

Method as_collapse

Makes the panel collapsed.
as_collapse()
Returns
Name Type Description
obj self The instance of this class.

Method horizontal

Makes the panel with the horizontal arrangement of encapsulating elements
horizontal()
Returns
Name Type Description
obj self The instance of this class.
Example
from bootwrap import Text, Panel

comp1 = Text("Component 1").add_classes("border")
comp2 = Text("Component 2").add_classes("border")
comp3 = Text("Component 3").add_classes("border")

Panel(comp1, comp2, comp3).horizontal()
Component 1
Component 2
Component 3

Method vertical

Makes the panel with the vertical arrangement of encapsulating elements
vertical()
Returns
Name Type Description
obj self The instance of this class.
Example
from bootwrap import Text, Panel

comp1 = Text("Component 1").add_classes("border")
comp2 = Text("Component 2").add_classes("border")
comp3 = Text("Component 3").add_classes("border")

Panel(comp1, comp2, comp3).vertical()
Component 1
Component 2
Component 3

Class Separator

A horizontal line separator.
Separator()
Example
from bootwrap import Panel, Separator, Text

Panel(
    Text("Top Text"),
    Separator(),
    Text("Bottom Text")
)
Top Text
Bottom Text

Class Table

A web component for a table.
Table(head, body)
Arguments
Name Type Description
head list The table head (1D array).
body list The table body (2D array).
Example
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

Property body

The table body.

Property head

The table head.

Method as_bordered

Adds borders on all sides of the table and cells.
as_bordered()
Returns
Name Type Description
obj self The instance of this class.
Example
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

Method as_dark

Inverts the colors—with light text on dark backgrounds.
as_dark()
Returns
Name Type Description
obj self The instance of this class.
Example
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

Method as_responsive

Create responsive tables.
as_responsive(breakpoint=)
Arguments
Name Type Description
breakpoint str The breakpoint to apply.
Returns
Name Type Description
obj self The instance of this class.
Example
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

Method as_small

Make tables more compact by cutting cell padding in half.
as_small()
Returns
Name Type Description
obj self The instance of this class.
Example
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

Method as_striped

Adds zebra-striping to any table row within the table body.
as_striped()
Returns
Name Type Description
obj self The instance of this class.
Example
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

Class Table.Head

The table head.
Table.Head(head)

Method as_dark

Makes the table head appears as dark gray.
as_dark()
Example
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()

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

Method as_light

Makes the table head appears as light gray.
as_light()
Example
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()

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

Class Table.Body

The table body.
Table.Body(body)

Method transform

Defines a function to transform a cell value
transform(index, entity, fn)
Arguments
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.
Example
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}"
)

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;

Class Text

A web component for a text.
Text(content)
Arguments
Name Type Description
content str The textual content.
Example
from bootwrap import Text

Text("Normal text")
Normal text

Method as_code

Makes the text wrap as a code snippet.
as_code()
Returns
Name Type Description
obj self The instance of this class.
Example
from bootwrap import Panel, Text

Text("print('Hello world!')").as_code()
print('Hello world!')

Method as_heading

Makes the text as heading.
as_heading(level)
Arguments
Name Type Description
level int The heading level;
Returns
Name Type Description
obj self The instance of this class.
Example
from bootwrap import Panel, Text

Panel(
    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)
)

Header text 1

Header text 2

Header text 3

Header text 4

Header text 5
Header text 6

Method as_muted

Makes the text muted.
as_muted()
Returns
Name Type Description
obj self The instance of this class.
Example
from bootwrap import Text

Text("Muted text").as_muted()
Muted text

Method as_paragraph

Makes the text wrap in a paragraph.
as_paragraph()
Returns
Name Type Description
obj self The instance of this class.
Example
from bootwrap import Panel, Text

Panel(
    Text("Paragraph 1").as_paragraph(),
    Text("Paragraph 2").as_paragraph(),
    Text("Paragraph 3").as_paragraph()
)

Paragraph 1

Paragraph 2

Paragraph 3

Method as_small

Makes the text as small.
as_small()
Returns
Name Type Description
obj self The instance of this class.
Example
from bootwrap import Text

Text("Small text").as_small()
Small text

Method as_strong

Makes the text as strong.
as_strong()
Returns
Name Type Description
obj self The instance of this class.
Example
from bootwrap import Text

Text("Strong text").as_strong()
Strong text