{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import panel as pn\n", "pn.extension()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The ``Feed`` inherits from the `Column` layout, thus allows arranging multiple panel objects in a vertical container, but limits the number of objects rendered at any given moment.\n", "\n", "Like `Column`, it has a list-like API with methods to ``append``, ``extend``, ``clear``, ``insert``, ``pop``, ``remove`` and ``__setitem__``, which make it possible to interactively update and modify the layout.\n", "\n", "#### Parameters:\n", "\n", "For details on other options for customizing the component see the [layout](../../how_to/layout/index.md) and [styling](../../how_to/styling/index.md) how-to guides.\n", "\n", "* **``objects``** (list): The list of objects to display in the Feed, should not generally be modified directly except when replaced in its entirety.\n", "* **``load_buffer``** (int): The number of objects loaded on each side of the visible objects. When scrolled halfway into the buffer, the Feed will automatically load additional objects while unloading objects on the opposite side.\n", "* **``scroll``** (boolean): Enable scrollbars if the content overflows the size of the container.\n", "* **``scroll_position``** (int): Current scroll position of the Feed. Setting this value will update the scroll position of the Column. Setting to 0 will scroll to the top.\n", "* **``auto_scroll_limit``** (int): Max pixel distance from the latest object in the Feed to activate automatic scrolling upon update. Setting to 0 disables auto-scrolling\n", "* **``scroll_button_threshold``** (int): Min pixel distance from the latest object in the Feed to display the scroll button. Setting to 0 disables the scroll button.\n", "* **``view_latest``** (bool): Whether to scroll to the latest object on init. If not enabled the view will be on the first object.\n", "* **``visible_range``** (list): Read-only upper and lower bounds of the currently visible Feed objects. This list is automatically updated based on scrolling.\n", "___" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "`Feed` is a `Column-like` layout that displays a Feed of objects. It is useful for displaying long outputs with many rows because of its ability to limit the number of entries loaded at once.\n", "\n", "When scrolled halfway into the `load_buffer`, the Feed will automatically load additional entries while unloading entries on the opposite side." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "Feed = pn.Feed(*list(range(1000)), load_buffer=20)\n", "Feed" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "To have the Feeds immediately initialized at the latest entry, set `view_latest=True`." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "Feed = pn.Feed(*list(range(1000)), view_latest=True)\n", "Feed" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Additionally, to allow users to scroll to the bottom interactively, set a `scroll_button_threshold` which will make the Feed display a clickable scroll button." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "Feed = pn.Feed(*list(range(1000)), scroll_button_threshold=20, width=300)\n", "Feed" ] } ], "metadata": { "language_info": { "name": "python", "pygments_lexer": "ipython3" } }, "nbformat": 4, "nbformat_minor": 2 }