@_with_element
def slider(self, element, label, min_value=None, max_value=None, value=None, step=None, format=None, key=None):
    'Display a slider widget.\n\n        This also allows you to render a range slider by passing a two-element tuple or list as the `value`.\n\n        Parameters\n        ----------\n        label : str or None\n            A short label explaining to the user what this slider is for.\n        min_value : int/float or None\n            The minimum permitted value.\n            Defaults to 0 if the value is an int, 0.0 otherwise.\n        max_value : int/float or None\n            The maximum permitted value.\n            Defaults 100 if the value is an int, 1.0 otherwise.\n        value : int/float or a tuple/list of int/float or None\n            The value of the slider when it first renders. If a tuple/list\n            of two values is passed here, then a range slider with those lower\n            and upper bounds is rendered. For example, if set to `(1, 10)` the\n            slider will have a selectable range between 1 and 10.\n            Defaults to min_value.\n        step : int/float or None\n            The stepping interval.\n            Defaults to 1 if the value is an int, 0.01 otherwise.\n        format : str or None\n            A printf-style format string controlling how the interface should\n            display numbers. This does not impact the return value.\n            Valid formatters: %d %e %f %g %i\n        key : str\n            An optional string to use as the unique key for the widget.\n            If this is omitted, a key will be generated for the widget\n            based on its content. Multiple widgets of the same type may\n            not share the same key.\n\n        Returns\n        -------\n        int/float or tuple of int/float\n            The current value of the slider widget. The return type will match\n            the data type of the value parameter.\n\n        Examples\n        --------\n        >>> age = st.slider(\'How old are you?\', 0, 130, 25)\n        >>> st.write("I\'m ", age, \'years old\')\n\n        And here\'s an example of a range slider:\n\n        >>> values = st.slider(\n        ...     \'Select a range of values\',\n        ...     0.0, 100.0, (25.0, 75.0))\n        >>> st.write(\'Values:\', values)\n\n        '
    if (value is None):
        value = (min_value if (min_value is not None) else 0)
    single_value = isinstance(value, (int, float))
    range_value = (isinstance(value, (list, tuple)) and (len(value) in (0, 1, 2)))
    if ((not single_value) and (not range_value)):
        raise StreamlitAPIException('Slider value should either be an int/float or a list/tuple of 0 to 2 ints/floats')
    if single_value:
        int_value = isinstance(value, int)
        float_value = isinstance(value, float)
    else:
        int_value = all(map((lambda v: isinstance(v, int)), value))
        float_value = all(map((lambda v: isinstance(v, float)), value))
    if ((not int_value) and (not float_value)):
        raise StreamlitAPIException('Slider tuple/list components must be of the same type.')
    if (min_value is None):
        min_value = (0 if int_value else 0.0)
    if (max_value is None):
        max_value = (100 if int_value else 1.0)
    if (step is None):
        step = (1 if int_value else 0.01)
    args = [min_value, max_value, step]
    int_args = all(map((lambda a: isinstance(a, int)), args))
    float_args = all(map((lambda a: isinstance(a, float)), args))
    if ((not int_args) and (not float_args)):
        raise StreamlitAPIException(('Slider value arguments must be of the same type.\n`value` has %(value_type)s type.\n`min_value` has %(min_type)s type.\n`max_value` has %(max_type)s type.' % {'value_type': type(value).__name__, 'min_type': type(min_value).__name__, 'max_type': type(max_value).__name__}))
    all_ints = (int_value and int_args)
    all_floats = (float_value and float_args)
    if ((not all_ints) and (not all_floats)):
        raise StreamlitAPIException(('Both value and arguments must be of the same type.\n`value` has %(value_type)s type.\n`min_value` has %(min_type)s type.\n`max_value` has %(max_type)s type.' % {'value_type': type(value).__name__, 'min_type': type(min_value).__name__, 'max_type': type(max_value).__name__}))
    if single_value:
        if (not (min_value <= value <= max_value)):
            raise StreamlitAPIException(('The default `value` of %(value)s must lie between the `min_value` of %(min)s and the `max_value` of %(max)s, inclusively.' % {'value': value, 'min': min_value, 'max': max_value}))
    elif (len(value) == 2):
        (start, end) = value
        if (not (min_value <= start <= end <= max_value)):
            raise StreamlitAPIException('The value and/or arguments are out of range.')
    else:
        value = [min_value, max_value]
    try:
        if all_ints:
            JSNumber.validate_int_bounds(min_value, '`min_value`')
            JSNumber.validate_int_bounds(max_value, '`max_value`')
        else:
            JSNumber.validate_float_bounds(min_value, '`min_value`')
            JSNumber.validate_float_bounds(max_value, '`max_value`')
    except JSNumberBoundsException as e:
        raise StreamlitAPIException(str(e))
    if (format is None):
        if all_ints:
            format = '%d'
        else:
            format = '%0.2f'
    element.slider.label = label
    element.slider.format = format
    element.slider.default[:] = ([value] if single_value else value)
    element.slider.min = min_value
    element.slider.max = max_value
    element.slider.step = step
    ui_value = _get_widget_ui_value('slider', element, user_key=key)
    current_value = (ui_value if (ui_value is not None) else value)
    if (ui_value is not None):
        current_value = getattr(ui_value, 'value')
        if all_ints:
            current_value = list(map(int, current_value))
        current_value = (current_value[0] if single_value else current_value)
    return (current_value if single_value else tuple(current_value))
Display a slider widget.

This also allows you to render a range slider by passing a two-element tuple or list as the `value`.

Parameters
----------
label : str or None
    A short label explaining to the user what this slider is for.
min_value : int/float or None
    The minimum permitted value.
    Defaults to 0 if the value is an int, 0.0 otherwise.
max_value : int/float or None
    The maximum permitted value.
    Defaults 100 if the value is an int, 1.0 otherwise.
value : int/float or a tuple/list of int/float or None
    The value of the slider when it first renders. If a tuple/list
    of two values is passed here, then a range slider with those lower
    and upper bounds is rendered. For example, if set to `(1, 10)` the
    slider will have a selectable range between 1 and 10.
    Defaults to min_value.
step : int/float or None
    The stepping interval.
    Defaults to 1 if the value is an int, 0.01 otherwise.
format : str or None
    A printf-style format string controlling how the interface should
    display numbers. This does not impact the return value.
    Valid formatters: %d %e %f %g %i
key : str
    An optional string to use as the unique key for the widget.
    If this is omitted, a key will be generated for the widget
    based on its content. Multiple widgets of the same type may
    not share the same key.

Returns
-------
int/float or tuple of int/float
    The current value of the slider widget. The return type will match
    the data type of the value parameter.

Examples
--------
>>> age = st.slider('How old are you?', 0, 130, 25)
>>> st.write("I'm ", age, 'years old')

And here's an example of a range slider:

>>> values = st.slider(
...     'Select a range of values',
...     0.0, 100.0, (25.0, 75.0))
>>> st.write('Values:', values)
@_with_element
def slider(self, element, label, min_value=None, max_value=None, value=None, step=None, format=None, key=None):
    'Display a slider widget.\n\n        This also allows you to render a range slider by passing a two-element tuple or list as the `value`.\n\n        Parameters\n        ----------\n        label : str or None\n            A short label explaining to the user what this slider is for.\n        min_value : int/float or None\n            The minimum permitted value.\n            Defaults to 0 if the value is an int, 0.0 otherwise.\n        max_value : int/float or None\n            The maximum permitted value.\n            Defaults 100 if the value is an int, 1.0 otherwise.\n        value : int/float or a tuple/list of int/float or None\n            The value of the slider when it first renders. If a tuple/list\n            of two values is passed here, then a range slider with those lower\n            and upper bounds is rendered. For example, if set to `(1, 10)` the\n            slider will have a selectable range between 1 and 10.\n            Defaults to min_value.\n        step : int/float or None\n            The stepping interval.\n            Defaults to 1 if the value is an int, 0.01 otherwise.\n        format : str or None\n            A printf-style format string controlling how the interface should\n            display numbers. This does not impact the return value.\n            Valid formatters: %d %e %f %g %i\n        key : str\n            An optional string to use as the unique key for the widget.\n            If this is omitted, a key will be generated for the widget\n            based on its content. Multiple widgets of the same type may\n            not share the same key.\n\n        Returns\n        -------\n        int/float or tuple of int/float\n            The current value of the slider widget. The return type will match\n            the data type of the value parameter.\n\n        Examples\n        --------\n        >>> age = st.slider(\'How old are you?\', 0, 130, 25)\n        >>> st.write("I\'m ", age, \'years old\')\n\n        And here\'s an example of a range slider:\n\n        >>> values = st.slider(\n        ...     \'Select a range of values\',\n        ...     0.0, 100.0, (25.0, 75.0))\n        >>> st.write(\'Values:\', values)\n\n        '
    if (value is None):
        value = (min_value if (min_value is not None) else 0)
    single_value = isinstance(value, (int, float))
    range_value = (isinstance(value, (list, tuple)) and (len(value) in (0, 1, 2)))
    if ((not single_value) and (not range_value)):
        raise StreamlitAPIException('Slider value should either be an int/float or a list/tuple of 0 to 2 ints/floats')
    if single_value:
        int_value = isinstance(value, int)
        float_value = isinstance(value, float)
    else:
        int_value = all(map((lambda v: isinstance(v, int)), value))
        float_value = all(map((lambda v: isinstance(v, float)), value))
    if ((not int_value) and (not float_value)):
        raise StreamlitAPIException('Slider tuple/list components must be of the same type.')
    if (min_value is None):
        min_value = (0 if int_value else 0.0)
    if (max_value is None):
        max_value = (100 if int_value else 1.0)
    if (step is None):
        step = (1 if int_value else 0.01)
    args = [min_value, max_value, step]
    int_args = all(map((lambda a: isinstance(a, int)), args))
    float_args = all(map((lambda a: isinstance(a, float)), args))
    if ((not int_args) and (not float_args)):
        raise StreamlitAPIException(('Slider value arguments must be of the same type.\n`value` has %(value_type)s type.\n`min_value` has %(min_type)s type.\n`max_value` has %(max_type)s type.' % {'value_type': type(value).__name__, 'min_type': type(min_value).__name__, 'max_type': type(max_value).__name__}))
    all_ints = (int_value and int_args)
    all_floats = (float_value and float_args)
    if ((not all_ints) and (not all_floats)):
        raise StreamlitAPIException(('Both value and arguments must be of the same type.\n`value` has %(value_type)s type.\n`min_value` has %(min_type)s type.\n`max_value` has %(max_type)s type.' % {'value_type': type(value).__name__, 'min_type': type(min_value).__name__, 'max_type': type(max_value).__name__}))
    if single_value:
        if (not (min_value <= value <= max_value)):
            raise StreamlitAPIException(('The default `value` of %(value)s must lie between the `min_value` of %(min)s and the `max_value` of %(max)s, inclusively.' % {'value': value, 'min': min_value, 'max': max_value}))
    elif (len(value) == 2):
        (start, end) = value
        if (not (min_value <= start <= end <= max_value)):
            raise StreamlitAPIException('The value and/or arguments are out of range.')
    else:
        value = [min_value, max_value]
    try:
        if all_ints:
            JSNumber.validate_int_bounds(min_value, '`min_value`')
            JSNumber.validate_int_bounds(max_value, '`max_value`')
        else:
            JSNumber.validate_float_bounds(min_value, '`min_value`')
            JSNumber.validate_float_bounds(max_value, '`max_value`')
    except JSNumberBoundsException as e:
        raise StreamlitAPIException(str(e))
    if (format is None):
        if all_ints:
            format = '%d'
        else:
            format = '%0.2f'
    element.slider.label = label
    element.slider.format = format
    element.slider.default[:] = ([value] if single_value else value)
    element.slider.min = min_value
    element.slider.max = max_value
    element.slider.step = step
    ui_value = _get_widget_ui_value('slider', element, user_key=key)
    current_value = (ui_value if (ui_value is not None) else value)
    if (ui_value is not None):
        current_value = getattr(ui_value, 'value')
        if all_ints:
            current_value = list(map(int, current_value))
        current_value = (current_value[0] if single_value else current_value)
    return (current_value if single_value else tuple(current_value))