inputs#

Various kinds of input widgets and form controls.

class AutocompleteInput(*args: Any, id: ID | None = None, **kwargs: Any)[source]#

Single-line input widget with auto-completion.

case_sensitive#

Enable or disable case sensitivity.

completions#

A list of completion strings. This will be used to guide the user upon typing the beginning of a desired value.

max_completions#

Optional maximum number of completions displayed.

min_characters#

The number of characters a user must type before completions are presented.

restrict#

Set to False in order to allow users to enter text that is not present in the list of completion strings.

search_strategy#

Define how to search the list of completion strings. The default option "starts_with" means that the user’s text must match the start of a completion string. Using "includes" means that the user’s text can match any substring of a completion string.

class Checkbox(*args: Any, id: ID | None = None, **kwargs: Any)[source]#

A checkbox widget.

class ColorPicker(*args: Any, id: ID | None = None, **kwargs: Any)[source]#

Color picker widget.

color#

The initial color of the picked color (named or hexadecimal)

Acceptable values are:

  • any of the named CSS colors, e.g 'green', 'indigo'

  • RGB(A) hex strings, e.g., '#FF0000', '#44444444'

  • CSS4 color strings, e.g., 'rgba(255, 0, 127, 0.6)', 'rgb(0 127 0 / 1.0)', or 'hsl(60deg 100% 50% / 1.0)'

  • a 3-tuple of integers (r, g, b) between 0 and 255

  • a 4-tuple of (r, g, b, a) where r, g, b are integers between 0 and 255, and a is between 0 and 1

  • a 32-bit unsigned integer using the 0xRRGGBBAA byte order pattern

class FileInput(*args: Any, id: ID | None = None, **kwargs: Any)[source]#

Present a file-chooser dialog to users and return the contents of the selected files.

clear() None[source]#

Clear the contents of this file input widget.

accept#

Comma-separated list of standard HTML file input filters that restrict what files the user can pick from. Values can be:

<file extension>:

Specific file extension(s) (e.g: .gif, .jpg, .png, .doc) are pickable

audio/*:

all sound files are pickable

video/*:

all video files are pickable

image/*:

all image files are pickable

<media type>:

A valid IANA Media Type, with no parameters.

Note

A bug in some versions of Chrome on macOS Big Sur may limit how you can set a file input filter for those users. In those cases, it is impossible to limit the user’s selection to specific file extensions - instead, the browser will limit users to predefined sets of file types, such as Text/* or Image/*. See #10888 for more information.

directory#

Whether to allow selection of directories instead of files.

The filename will be relative paths to the uploaded directory.

Note

When a directory is uploaded it will give add a confirmation pop up. The confirmation pop up cannot be disabled, as this is a security feature in the browser.

Note

The accept parameter only works with file extension. When using accept with directory, the number of files reported will be the total amount of files, not the filtered.

filename#

The name(s) of the file or files that were loaded.

If multiple is set to False (default), this value is a single string with the name of the single file that was chosen.

If multiple is True, this value is a list of strings, each containing the name of one of the multiple files that were chosen.

This list provides the sequence of files for the respective lists in value and mime-type

Note

The full file path is not included since browsers will not provide access to that information for security reasons.

mime_type#

The mime-type of the file or files that were loaded.

If multiple is set to False (default), this value is a single string with the mime-type of the single file that was chosen.

If multiple is True, this value is a list of strings, each containing the mime-type of one of the multiple files that were chosen.

The sequence of files is given by the list of filename (see below)

multiple#

set multiple=False (default) for single file selection, set multiple=True if selection of more than one file at a time should be possible.

value#

The base64-encoded contents of the file or files that were loaded.

If multiple is set to False (default), this value is a single string with the contents of the single file that was chosen.

If multiple is True, this value is a list of strings, each containing the contents of one of the multiple files that were chosen.

The sequence of files is given by the list of filenames (see below)

class InputWidget(*args: Any, id: ID | None = None, **kwargs: Any)[source]#

Abstract base class for input widgets.

Note

This is an abstract base class used to help organize the hierarchy of Bokeh model types. It is not useful to instantiate on its own.

description#

Either a plain text or a tooltip with a rich HTML description of the function of this widget.

title#

Widget’s label.

class LightDark(*args: Any, id: ID | None = None, **kwargs: Any)[source]#

A switch widget to change between themes (light and dark).

class MultiChoice(*args: Any, id: ID | None = None, **kwargs: Any)[source]#

MultiChoice widget.

delete_button#

Whether to add a button to remove a selected option.

max_items#

The maximum number of items that can be selected.

option_limit#

The number of choices that will be rendered in the dropdown.

options#

Available selection options. Options may be provided either as a list of possible string values, or as a list of tuples, each of the form (value, label). In the latter case, the visible widget text for each value will be corresponding given label.

placeholder#

A string that is displayed if not item is added.

search_option_limit#

The number of choices that will be rendered in the dropdown when search string is entered.

solid#

Specify whether the choices should be solidly filled.

value#

Initial or selected values.

class MultiSelect(*args: Any, id: ID | None = None, **kwargs: Any)[source]#

Multi-select widget.

options#

Available selection options. Options may be provided either as a list of possible string values, or as a list of tuples, each of the form (value, label). In the latter case, the visible widget text for each value will be corresponding given label.

size#

The number of visible options in the dropdown list. (This uses the select HTML element’s size attribute. Some browsers might not show less than 3 options.)

value#

Initial or selected values.

class NumericInput(*args: Any, id: ID | None = None, **kwargs: Any)[source]#

Numeric input widget.

format#
high#

Optional highest allowable value.

low#

Optional lowest allowable value.

mode#

Define the type of number which can be enter in the input

example mode int: 1, -1, 156 mode float: 1, -1.2, 1.1e-25

placeholder#

Placeholder for empty input field.

value#

Initial or entered value.

Change events are triggered whenever <enter> is pressed.

class PaletteSelect(*args: Any, id: ID | None = None, **kwargs: Any)[source]#

Color palette select widget.

items#

A selection of named color palettes to choose from.

ncols#

The number of columns to split the display of the palettes into.

swatch_height#

The height of the UI element showing the preview of a palette, either in pixels or automatically adjusted.

swatch_width#

The width of the UI element showing the preview of a palette, in pixels.

value#

The name of the initial or selected color palette.

class PasswordInput(*args: Any, id: ID | None = None, **kwargs: Any)[source]#

Single-line password input widget.

This widget hides the input value so that it is not visible in the browser.

Warning

Secure transmission of the password to Bokeh server application code requires configuring the server for SSL (i.e. HTTPS) termination.

class Select(*args: Any, id: ID | None = None, **kwargs: Any)[source]#

Single-select widget.

options#

Available selection options.

Options may be provided either as a list of possible string values, which also act as options’ labels, or as a list of tuples, each of the form (value, label), where value can be of any type, not necessarily a string. In the latter case, the visible widget text for each value will be corresponding given label.

Option groupings can be provided by supplying a dictionary object whose values are in the aforementioned list format.

value#

Initial or selected value.

class Spinner(*args: Any, id: ID | None = None, **kwargs: Any)[source]#

Numeric Spinner input widget.

page_step_multiplier#

Defines the multiplication factor applied to step when the page up and page down keys are pressed.

step#

The step added or subtracted to the current value.

value_throttled#

Value reported at the end of interactions.

wheel_wait#

Defines the debounce time in ms before updating value_throttled when the mouse wheel is used to change the input.

class Switch(*args: Any, id: ID | None = None, **kwargs: Any)[source]#

A checkbox-like widget.

indeterminate_icon#

Icon to represent widget indeterminate state (active = None).

off_icon#

Icon to represent widget off state (active = False).

on_icon#

Icon to represent widget on state (active = True).

class TextAreaInput(*args: Any, id: ID | None = None, **kwargs: Any)[source]#

Multi-line input widget.

cols#

20

Type:

Specifies the width of the text area (in average character width). Default

rows#

2

Type:

Specifies the height of the text area (in lines). Default

class TextInput(*args: Any, id: ID | None = None, **kwargs: Any)[source]#

Single-line input widget.

prefix#

An optional string prefix to display before the input. This is useful to indicate e.g. a variable the entered value will be assigned to.

suffix#

An optional string suffix to display after the input. This is useful to indicate e.g. the units of measurement of the entered value.

ColorMap(*args: Any, **kwargs: Any) PaletteSelect[source]#

Color palette select widget.

Deprecated since version 3.4.0: Use PaletteSelect widget instead.