Skip to content

Input Components

Creates and returns an instance of the InputDropdown component.

Parameters:

Name Type Description Default
name str

Name of the dropdown component. This should be a unique string name for this component within the form group.

required
label str

Display label for the dropdown.

required
values tuple or list

Either a list of dropdown values or a tuple containing a DataFrame and column name.

required
action_url str

URL to which the form submits. Defaults to "/".

'/'
selected_value str

Initially selected value in the dropdown. Defaults to "Select All".

'Select All'

Returns:

Name Type Description
InputDropdown

An instance of the InputDropdown component.

Example with Tuple:

In the below example, we are giving the dropdown a unique identifier of condition_selection, with a label of Select a condition, and the values from the dataframe dfand the column condition.

ComponentManager.Inputs.dropdown(
    name = 'condition_selection', 
    label = 'Select a condition: ', 
    values = (df, 'condition'))
Source code in dashboard_builder/managers.py
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
@staticmethod
def dropdown(name, label, values, action_url="/", selected_value="Select All"): # noqa
    """
    Creates and returns an instance of the InputDropdown component. 

    Args:
        name (str): Name of the dropdown component. This should be a unique
                string name for this component within the form group. 
        label (str): Display label for the dropdown. 
        values (tuple or list): Either a list of dropdown values or a 
                                tuple containing a DataFrame and column name.
        action_url (str, optional): URL to which the form submits. 
                                    Defaults to "/".
        selected_value (str, optional): Initially selected value in the 
                                        dropdown. Defaults to "Select All".

    Returns:
        InputDropdown: An instance of the InputDropdown component.

    Example with Tuple:
    >>> In the below example, we are giving the dropdown a unique identifier 
    of condition_selection, with a label of `Select a condition`, and the 
    values from the dataframe `df`and the column `condition`. 

        ComponentManager.Inputs.dropdown(
            name = 'condition_selection', 
            label = 'Select a condition: ', 
            values = (df, 'condition'))

    """
    return InputDropdown(name, label, values, action_url, selected_value) # noqa

Creates and returns an instance of the TextInput component.

Parameters:

Name Type Description Default
name str

Name of the text input component.

required
label str

Display label for the text input.

required
default_value str

Default value for the text input. Defaults to an empty string.

''

Returns:

Name Type Description
TextInput

An instance of the TextInput component.

Source code in dashboard_builder/managers.py
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
@staticmethod
def text(name, label, default_value=""):
    """
    Creates and returns an instance of the TextInput component.

    Args:
        name (str): Name of the text input component.
        label (str): Display label for the text input.
        default_value (str, optional): Default value for the text input. 
                                Defaults to an empty string.

    Returns:
        TextInput: An instance of the TextInput component.
    """
    return TextInput(name, label, default_value)

Creates and returns an instance of the InputRadio component.

Parameters:

Name Type Description Default
name str

Name of the radio button input component.

required
label str

Display label for the radio button input.

required
options list

List of options for the radio button.

required
default_value str

Default option for the radio button. If not provided, the first option will be chosen.

None

Returns:

Name Type Description
InputRadio

An instance of the InputRadio component.

Source code in dashboard_builder/managers.py
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
@staticmethod
def radio(name, label, options, default_value=None):
    """
    Creates and returns an instance of the InputRadio component.

    Args:
        name (str): Name of the radio button input component.
        label (str): Display label for the radio button input.
        options (list): List of options for the radio button.
        default_value (str, optional): Default option for the radio button. 
                        If not provided, the first option will be chosen.

    Returns:
        InputRadio: An instance of the InputRadio component.
    """
    return InputRadio(name, label, options, default_value)

Creates and returns an instance of the InputSlider_Numerical component.

Parameters:

Name Type Description Default
name str

Name of the slider input component.

required
label str

Display label for the slider input.

required
min_value int

Minimum value for the slider. Defaults to 0.

0
max_value int

Maximum value for the slider. Defaults to 100.

100
step int

Step increment for the slider. Defaults to 1.

1
default_value int

Default value for the slider. Defaults to 50.

50

Returns:

Name Type Description
InputSlider_Numerical

An instance of the InputSlider_Numerical component.

Source code in dashboard_builder/managers.py
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
@staticmethod
def slider_numerical(name, label, min_value=0, max_value=100, step=1, default_value=50): # noqa
    """
    Creates and returns an instance of the InputSlider_Numerical component.

    Args:
        name (str): Name of the slider input component.
        label (str): Display label for the slider input.
        min_value (int, optional): Minimum value for the slider. Defaults to 0.
        max_value (int, optional): Maximum value for the slider. Defaults 
                                    to 100.
        step (int, optional): Step increment for the slider. Defaults to 1.
        default_value (int, optional): Default value for the slider. 
                                        Defaults to 50.

    Returns:
        InputSlider_Numerical: An instance of the InputSlider_Numerical 
            component.
    """
    return InputSlider_Numerical(name, label, min_value, max_value, step, default_value) #noqa

Creates and returns an instance of the InputSlider_Categorical component.

Parameters:

Name Type Description Default
name str

Name of the slider input component.

required
label str

Display label for the slider input.

required
categories list

List of categories for the slider.

required
default_value str

Default category for the slider. If not provided, the first category will be chosen.

None

Returns:

Name Type Description
InputSlider_Categorical

An instance of the InputSlider_Categorical component.

Source code in dashboard_builder/managers.py
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
@staticmethod
def slider_categorical(name, label, categories, default_value=None):
    """
    Creates and returns an instance of the InputSlider_Categorical component.

    Args:
        name (str): Name of the slider input component.
        label (str): Display label for the slider input.
        categories (list): List of categories for the slider.
        default_value (str, optional): Default category for the slider. 
                                    If not provided, the first category will 
                                    be chosen.

    Returns:
        InputSlider_Categorical: An instance of the InputSlider_Categorical 
                                component.
    """
    return InputSlider_Categorical(name, label, categories, default_value)