{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import panel as pn\n",
    "pn.extension()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The ``Progress`` widget displays the progress towards some target based on the current `value` and the `max` value. If no `value` is set or a `value` of -1 is set the ``Progress`` widget is in indeterminate mode and will animate if `active` is set to True.\n",
    "\n",
    "For more information about listening to widget events and laying out widgets refer to the [widgets user guide](../../user_guide/Widgets.ipynb). Alternatively you can learn how to build GUIs by declaring parameters independently of any specific widgets in the [param user guide](../../user_guide/Param.ipynb). To express interactivity entirely using Javascript without the need for a Python server take a look at the [links user guide](../../user_guide/Param.ipynb).\n",
    "\n",
    "#### Parameters:\n",
    "\n",
    "For layout and styling related parameters see the [customization user guide](../../user_guide/Customization.ipynb).\n",
    "\n",
    "* **``active``** (boolean): Whether to animate the bar when in indeterminate mode\n",
    "* **``bar_color``** (str): The color of the bar, one of 'primary', 'secondary', 'success', 'info', 'warning', 'danger', 'light', 'dark'\n",
    "* **``max``** (int): The maximum progress value\n",
    "* **``style``** (dict): A dictionary of CSS to apply to the progress bar\n",
    "* **``value``** (int): The current value towards the progress, set to -1 for an indeterminate state\n",
    "\n",
    "___"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The `Progress` widget can be instantiated with and without a value. If given a `value` the progress bar will fill according to the progress to the `max` value which is 100 by default:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "progress = pn.indicators.Progress(name='Progress', value=20, width=200)\n",
    "progress"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The progress `value` can be updated from Python:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "progress.value = 80"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The `Progress` can also be instantiated without a `value`:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "indeterminate = pn.indicators.Progress(name='Indeterminate Progress', active=True, width=200)\n",
    "indeterminate"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The `Progress` widget also supports a range of bar colors:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "running = pn.Column(*[\n",
    "    pn.Row(pn.panel(bs, width=100), pn.indicators.Progress(width=300, value=10+i*10, bar_color=bs))\n",
    "        for i, bs in enumerate(pn.indicators.Progress.param.bar_color.objects)\n",
    "])\n",
    "running"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Controls\n",
    "\n",
    "The `Progress` widget exposes a number of options which can be changed from both Python and Javascript. Try out the effect of these parameters interactively:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "pn.Row(progress.controls(jslink=True), progress, indeterminate.controls(jslink=True), indeterminate)"
   ]
  }
 ],
 "metadata": {
  "language_info": {
   "name": "python",
   "pygments_lexer": "ipython3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
