Types#
Token and keyword types for annotating your own helpers and widget subclasses.
These are the names that appear in widget signatures — the accent/variant/surface
tokens, the layout literals, density, and the keyword TypedDicts. Import them
from bootstack.types when you annotate code that builds on bootstack:
from bootstack.types import AccentToken, WidgetDensity
Style and state tokens#
Semantic tokens for color, variant, and surface, plus density, state, and the lower-level appearance literals.
- type bootstack.types.AccentToken#
A semantic color accent —
'primary','secondary','info','success','warning','danger'. Accent params widen it with| str, also accepting'default','muted', and modifiers like'primary[500]'.
- type bootstack.types.AccordionVariant#
Accordion header style —
'solid', or'default'for a ghost/transparent header.
- type bootstack.types.BorderMode#
Border placement for the place geometry manager —
'inside'or'outside'.
- type bootstack.types.ButtonVariant#
Style variant shared by the button family (Button, ButtonGroup, CommandBar, MenuButton, SelectButton, ToggleButton, ToggleGroup) —
'default','solid','outline', or'ghost'.
- type bootstack.types.CompoundMode#
Position of an image relative to its text —
'text','image','top','bottom','left','right','center','none'.
- type bootstack.types.Relief#
Border relief style —
'flat','raised','sunken','groove','ridge','solid'.
- type bootstack.types.SurfaceToken#
Background surface context —
'content','card','card_raised','chrome','overlay'.
- type bootstack.types.VariantToken#
Widget style variant —
'solid','outline','ghost','toggle'.
- type bootstack.types.WidgetDensity#
Sizing density —
'default', or'compact'for reduced padding.
- type bootstack.types.ScrollbarVariant#
Scrollbar style —
'default'for the standard rounded bar, or'thin'for a slim square bar that suits compact lists, panels, and popups.
- type bootstack.types.WidgetState#
Widget interaction state —
'normal','active','disabled','readonly'.
- type bootstack.types.WindowStyle#
A Windows-only window effect (no-op elsewhere) —
'mica','acrylic','aero','transparent','win7'. The underlying pywinstyles library accepts more, passed as a plain string.
Layout literals#
The placement and sizing literals accepted by container and **kwargs layout
options.
- type bootstack.types.Anchor#
Alignment anchor position —
'n','ne','e','se','s','sw','w','nw','center'.
- type bootstack.types.AutoFlow#
Grid auto-placement direction —
'row','column','row-dense','column-dense','none'.
- type bootstack.types.Direction#
Layout direction —
'vertical','horizontal','row','column','row-reverse','column-reverse'.
- type bootstack.types.Fill#
Fill axis for stack layout —
'none','x','y','both', with readable aliases'horizontal','vertical','all'.
- type bootstack.types.IconPosition#
Position of an icon relative to a widget’s text —
'left','right','top', or'bottom'.
- type bootstack.types.Justify#
Text justification within a widget —
'left','center','right'.
- type bootstack.types.LayoutKind#
A container’s internal layout manager —
'vstack','hstack','grid'.
- type bootstack.types.Orient#
Widget orientation —
'horizontal','vertical'.
- type bootstack.types.Padding#
Widget padding in pixels — a single
intfor all sides,(x, y)for the horizontal and vertical amounts, or(left, top, right, bottom).
- type bootstack.types.Region#
Placement region within a menu bar —
'before','center', or'after'.
- type bootstack.types.Side#
Side placement for stack layout —
'left','top','right','bottom'.
- type bootstack.types.Sticky#
Cell alignment for Grid layout — any combination of
'n','s','e','w'(e.g.'nsew').
Data and selection#
Literals for selection behavior and tabular data export.
- type bootstack.types.ExportFormat#
A tabular export format —
'csv','tsv', or'xlsx'.
- type bootstack.types.ExportScope#
Which rows an export covers —
'all'rows, the current'page', or the current'selection'.
- type bootstack.types.Option#
A single choice for
Select,SelectButton,RadioGroup, orToggleGroup— a plainstr(text and value are the same), a(text, value)tuple, or anOptionDict. Lets an option’s displayed label differ from its stored value.
- type bootstack.types.Icon#
An icon as either a Bootstrap Icons name (
'bell-fill') or anIconSpecmapping for control over size and color.
- type bootstack.types.SelectionMode#
How many rows or items can be selected —
'none','single', or'multi'.
Keyword and config types#
The TypedDict shapes for low-level widget options and the data-entry config
that DataTable and Form accept.
- class bootstack.types.BaseWidgetKwargs#
Bases:
TypedDictLow-level options shared by all bootstack widget wrappers.
- class bootstack.types.ColumnSpec#
Bases:
TypedDictA column definition for
DataTable(columns=...).Columns may be plain key strings or these dicts. Only
keyis required; the editor keys (editor,editor_options,dtype,readonly,required) shape how the column appears in the built-in add/edit dialog.- editor: Literal['textfield', 'numberfield', 'passwordfield', 'datefield', 'textarea', 'select', 'spinnerfield', 'switch', 'checkbox', 'slider']#
Field type used to edit this column in the add/edit dialog. Inferred from
dtypewhen omitted.
- type bootstack.types.EditorType#
The field type used to edit a value in a
FormorDataTableadd/edit dialog, inferred from the value’sdtypewhen omitted —'textfield','numberfield','passwordfield','datefield','textarea','select','spinnerfield','switch','checkbox','slider'.
- class bootstack.types.FormOptions#
Bases:
TypedDictLayout options for the built-in add/edit dialog (
DataTable(form=...)).
- class bootstack.types.IconSpec#
Bases:
TypedDictA detailed icon specification: a Bootstrap icon name with size and color.
Use in place of a plain icon name wherever a widget accepts
icon=, to control the rendered size and color — for exampleicon={'name': 'bell-fill', 'size': 24, 'color': 'primary'}.
- class bootstack.types.OptionDict#
Bases:
TypedDictA single choice for a selection widget, in dict form.
The dict form is a data bag:
textis required (andvaluedefaults to it) UNLESS the dict carries aniconand avalue, in which casetextmay be omitted to request an icon-only option.text/valueand the recognizedicon/disabledkeys act on rendering; every other key rides along as carried data — retrievable as the widget’sselection(the selected option’s full record). Unrecognized keys are accepted, not rejected, so the dict route trades key-typo safety for extensibility.
- class bootstack.types.StyledKwargs#
Bases:
BaseWidgetKwargsExtends BaseWidgetKwargs with bootstack styling tokens.