Skip to content

Bootstrap Icons API

ttkbootstrap_icons_bs.icon

BootstrapStyles = Literal['outline', 'fill'] module-attribute

BootstrapFontProvider

Bases: BaseFontProvider

Provider for the Bootstrap Icons dataset.

Bootstrap ships two styles - "outline" and "fill" - encoded by the presence of a "-fill" suffix in the raw glyph name. Both styles share the same font file and are separated via a predicate per style.

Attributes:

Name Type Description
name

Provider identifier ("bootstrap").

display_name

Human-friendly name ("Bootstrap").

default_style

Default style ("outline").

styles

Map of style -> {filename, predicate}.

__init__()

Initialize the provider with style configuration.

Uses a single font file (bootstrap.ttf) for both styles. Style selection is performed by predicates that test for the -fill suffix.

Note

The provider expects glyphmaps named glyphmap.json (single-file) or glyphmap-<style>.json when styles require separate maps.

BootstrapIcon

Bases: Icon

Convenience icon for the Bootstrap glyph set.

Resolves the provided name (optionally with a style) using BootstrapFontProvider, then initializes the base Icon with the resolved glyph.

Parameters:

Name Type Description Default
name str

Glyph name. May be a friendly name (e.g. "house") or a raw glyph (e.g. "house-fill"). If you pass a conflicting style (e.g. name ends with "-fill" but you set style="outline"), a ValueError is raised.

required
size int

Pixel size of the rasterized image (default: 24).

24
color str

Foreground color used to render the glyph (default: "black").

'black'
style BootstrapStyles | None

Optional style override: "outline" or "fill". If omitted, the provider's default style is used. When name already encodes a style suffix (e.g. "-fill"), that suffix takes precedence.

None

Raises:

Type Description
ValueError

If the name cannot be resolved for the requested style.

ttkbootstrap_icons_bs.provider

BootstrapFontProvider

Bases: BaseFontProvider

Provider for the Bootstrap Icons dataset.

Bootstrap ships two styles - "outline" and "fill" - encoded by the presence of a "-fill" suffix in the raw glyph name. Both styles share the same font file and are separated via a predicate per style.

Attributes:

Name Type Description
name

Provider identifier ("bootstrap").

display_name

Human-friendly name ("Bootstrap").

default_style

Default style ("outline").

styles

Map of style -> {filename, predicate}.

__init__()

Initialize the provider with style configuration.

Uses a single font file (bootstrap.ttf) for both styles. Style selection is performed by predicates that test for the -fill suffix.

Note

The provider expects glyphmaps named glyphmap.json (single-file) or glyphmap-<style>.json when styles require separate maps.